holding the prompt until the exe is finished

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
docetes
Posts: 3
Joined: 16 Jul 2010 02:55

holding the prompt until the exe is finished

#1 Post by docetes » 16 Jul 2010 03:06

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

firebloodphoenix
Posts: 16
Joined: 16 Jul 2010 01:29

Re: holding the prompt until the exe is finished

#2 Post by firebloodphoenix » 16 Jul 2010 03:20

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"

docetes
Posts: 3
Joined: 16 Jul 2010 02:55

Re: holding the prompt until the exe is finished

#3 Post by docetes » 16 Jul 2010 03:26

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

firebloodphoenix
Posts: 16
Joined: 16 Jul 2010 01:29

Re: holding the prompt until the exe is finished

#4 Post by firebloodphoenix » 16 Jul 2010 03:43

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

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: holding the prompt until the exe is finished

#5 Post by aGerman » 16 Jul 2010 05:30

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

docetes
Posts: 3
Joined: 16 Jul 2010 02:55

Re: holding the prompt until the exe is finished

#6 Post by docetes » 19 Jul 2010 03:30

that was exactly what I was looking for.

Thanks,
Dave

Post Reply