
Bad Command or File name when Shelling DOS Batch File
Quote:
>x = Shell("c:\gstools\gs5.50\ps2pdf.bat c:\mydocu~1\sdfler5.ps
>c:\mydocu~1\sdfler5.pdf", 1)
>Running this produces a "Bad Command or File Name Error" at the point the
>batch tries to execute the command.
The "Bad Command or Filename" is a DOS error message, which means that
the Shell statement does execute your batch file. The problem is this:
if you execute a command from the Start->Run dialog, Windows sets the
current drive/directory to the one the executable (or, in your case,
batch file) resides in. The VB Shell statement does no such thing. As a
result, when the batch file tries to execute ghostscript, it can't find
it. The solution therefore is: change drive and directory to those of
the program you want to execute before you run the Shell statement.
Gertjan.