Page 1 of 1

holding the prompt until the exe is finished

Posted: 16 Jul 2010 03:06
by docetes
Hi All,

First time poster here :)
My problem is I want to execute an exe and I want the command prompt to wait until the program is finished.
Not sure if I have explained myself all that well so if you need any more information I'll provide it.

Thanks,
Dave

Re: holding the prompt until the exe is finished

Posted: 16 Jul 2010 03:20
by firebloodphoenix
first download a file called Nircmd
http://www.nirsoft.net/utils/nircmd.html
in my code you will see me waiting for the exe and then starting it up after the exe is closed
and it also hids my cmd box if the title of the box was SpyBot_Loader

Code: Select all

nircmd exec show "%systemdrive%\spybot\RunSpybot.exe"
nircmd win hide ititle "SpyBot_Loader"
nircmd waitprocess RunSpybot.exe
nircmd waitprocess Spybotsd.exe
nircmd win show ititle "SpyBot_Loader"

Re: holding the prompt until the exe is finished

Posted: 16 Jul 2010 03:26
by docetes
unfortunately I have to do it from the command prompt without installing any other software(i'm in work). If there is a VBScript way of doing it I could use that

Re: holding the prompt until the exe is finished

Posted: 16 Jul 2010 03:43
by firebloodphoenix
sorry i dont know vb only .bat and .com coding
the nircmd is a exe that allows you to do additional coding in your cmd(.bat/.com) files
just by typing nircmd(your .bat file has to be in the same folder as the nircmd.exe)
and then your command eg:

Code: Select all

nircmd waitprocess RunSpybot.exe  

you can run a host of functions in your bat scripts
their is a lot of things you can do just read the help files on the web site to see what functions nircmd offers

Re: holding the prompt until the exe is finished

Posted: 16 Jul 2010 05:30
by aGerman
From the command prompt you have to use START /WAIT.

Code: Select all

start "" /wait "name.exe"

If this doesn't work, you have to write the entire path.

Regards
aGerman

Re: holding the prompt until the exe is finished

Posted: 19 Jul 2010 03:30
by docetes
that was exactly what I was looking for.

Thanks,
Dave