SHELL to open an application and pass parameters to it

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
 
J

jwkz

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
 
J

jwkz

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top