Running DOS commands: This might be helpful to know.

Got a problem you cannot solve? Try here.
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Running DOS commands: This might be helpful to know.

Postby bokkie » Tue May 12, 2009 5:27 am

Guys,

I wanted to give some feedback about running DOS commands in IA. I've been fighting a particularly nasty problem on my XP machine at work where, under some conditions, DOS commands are not executing properly even though the syntax of the commands was valid. It then occurred to me that I was possibly taking the wrong approach. I've implemented a solution that is now running stable. What I implemented is this:

Use the Run Program statement as normal. In the Run Program textbox enter cmd.exe.

In the Command Line Parameters textbox enter /C copy A B /b /y replacing the copy... statement with the fully described DOS command you want to execute. You can get the full syntax of cmd.exe in a DOS window using cmd.exe /?. Notice the /C option. That waits for the command to finish which more or less complements the Wait For Program to Finish tickbox in the Run Program dialog displayed by IA.

I've found this to be much more stable. It does a similar function but I like it as I can keep the command and arguments glued together in one string. Your mileage will vary, as they say, but I've now fixed a vexing problem that's been bugging me for a while. 8)
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP

JeffTucker
Posts: 62
Joined: Thu Mar 19, 2009 11:07 am
Contact:

What were the issues?

Postby JeffTucker » Tue May 12, 2009 7:49 am

Just curious why the straight up dos commands did not work. Did you find anything? What sort of commands were these? Service commands?
Fiddling with technology

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Tue May 12, 2009 7:58 am

Great post!

"Straightforward" DOS commands like copy are NOT executable files. They are commands that are parsed and run by the cmd.exe command line interpreter. Therefore, if you use them as your main command in Run Program, they will fail.

In other words, no copy.exe exists on your system...
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Re: What were the issues?

Postby bokkie » Tue May 12, 2009 8:09 am

JeffTucker wrote:Just curious why the straight up dos commands did not work. Did you find anything? What sort of commands were these? Service commands?


Jeff, it was not just the copy that was failing but other commands. Even the humble and very basic date /t was failing. I've tested a few commands and they all now work 100% fine. What was interesting is that I built the three packages I'm using at home last night. I ran them on my work machine and they worked. When I built them however, that's when the problems became apparent again. I'm convinced my XP machine at work has something spooked on it which is causing build-and-run to behave abnormally unless I use cmd.exe. I got into the habit a while back of using it in my code but in the rush to complete my projects I forgot to keep that in the foreground of my head.

Edit: I also endorse Michael's comment about the difference between internal and exernal command usage.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 26 guests