
WshShell.Exec Passing Invalid Argument to CL App
I'm stumped with this problem. I've got a command line utility that reports
info about Macintosh files that are stored on a Windows server (that's not
really relevant to this problem though, I don't think). The syntax is as
follows:
C:\macbinconv.exe -mb "C:\Dir 1\Dir 2\file.bin" -info
If I run this directly from the command line, it *always* works correctly.
The file refernce can be a local file or it can be a file on a remote server
referenced by its UNC path. So for example, the following also works:
C:\macbinconv.exe -mb "\\SERVER05\Dir 1\file.bin" -info
I need to be able to call this util from an ASP app, so I thought I'd just
use the WshShell object. However it is not working when the file reference
is a UNC path.
This works:
--snip--
Set WshShell = Server.CreateObject("WScript.Shell")
cmd = "C:\macbinconv.exe -mb ""C:\Dir 1\Dir 2\file.bin"" -info"
Set oExec = WshShell.Exec(cmd)
--snip--
But this noes NOT work:
--snip--
Set WshShell = Server.CreateObject("WScript.Shell")
cmd = "C:\macbinconv.exe -mb "\\SERVER05\Dir 1\file.bin" -info"
Set oExec = WshShell.Exec(cmd)
--snip--
It errors out as if the file refernce is not correct. I can get the same
behavior by manually running the util from the comand line but leaving off
the quotes around the file reference. That led me to believe that maybe
something was wrong with the way the quotes were included in the file
reference. I tried removing the quotes, escaping the quotes, double quotes,
single quotes, basically every quote trick, but that made no difference.
This is driving me crazy. This util is something I got from Sourceforge.net,
unfortunately I'm not proficent in C++ to look at the source and see if the
problem lies there.
What I'm wondering though, does this seem like it could be a bug in the
utility itself, or is there something screwy with the way that the arguments
are being passed to the util via WshShell.Exec? I can't figure why it would
work perfectly fine if invoke from the command line but fail if invoked via
WshShell.Exec. Doesn't WshShell.Exec do exactly the same thing as when the
command is manually entered? Perhaps I'm missing something simple here. Any
insight would be greatly appreciated.
Thnx
Chris M