SHELL to open an application and pass parameters to it

  • Thread starter Thread starter jwkz
  • Start date Start date
J

jwkz

I have a compiler that operates on an XML file to create a BGL graphic
file.

At a command prompt, the syntax is [bglcomp.exe test.xml] and th
output would be test.bgl.

Trying to automate this in the macro that creates the XML code, an
with both files in path C:\Temp, I tried:

ID = Shell("C:\Temp\bglcomp.exe test.xml")

This runs with no error messages, but does not compile the XML file.
What is the correct method
 
Jim, thanks for the suggestion.

Your statement also runs without error, and delivers a valid ID number,
but does not compile the xml file.

I then tried putting a [,1] at the end to keep the app window open, to
see if there were any error messages there. However, the command
prompt window just flashes briefly, then closes. Unlike the old DOS
window in Win98, there seems to be no way to tell it to remain open
after the app terminates.

John
 
For anyone else interested, there were two problems, now resolved.

1) Shell wants cmd, not command to open the command window

2) The "Temp" path in my example was really a nest of folders, an
included the "Program Files" folder. But the Shell command used woul
not accept the two-word folder name.

Restructuring the syntax as follows gives a successful result. I
passes two sequential commands, the first a DOS change directory t
open the folder, followed by the executable and the xml file it is t
compile.

x = Shell("cmd /c cd C:\Program Files\Subfolder&&bglcomp.ex
test.xml")

Could also have been done by calling a batch file, but this seem
cleaner
 
Back
Top