Irongeek

Batch Files: Run exes asynchronously

12 posts in this topic

Anyone have a good way to run exes from a batchfile in XP asynchronously? I use to be able to use commands like:

start notepad.exe

start calc.exe

but that does not work if I'm using the batch file from an iexpress package. Any other ways you know to get both exes running at the same time using a batch file?

1

Share this post


Link to post
Share on other sites

This seems to work, not sure if it will with your IExpress package because I don't know how to test it:

echo Set WshShell = WScript.CreateObject("WScript.Shell") >> file.vbs
echo WshShell.Run("%windir%\notepad.exe") >> file.vbs
echo WshShell.Run("%windir%\system32\calc.exe") >> file.vbs
file.vbs

The idea is to use commands to create a VBScript file that will do the launching, then execute that synchrously.

Hope this was helpful, as I have found your tut's helpful :D

1

Share this post


Link to post
Share on other sites

Thanks, I'll give that a shot.

1

Share this post


Link to post
Share on other sites

Cool, your script works as just a batch file, but iexpress messes it up (I think it does werid things with running from the present working directory). With a few mods I got it to work:


echo Set WshShell = WScript.CreateObject("WScript.Shell") > file.vbs
echo WshShell.Run("putty.exe") >> file.vbs
echo WshShell.Run("vncviewer.exe") >> file.vbs
wscript file.vbs
pause

Thanks, I'll be sure to give you shouts in the video. If anyone has a easier way give me a yell.

1

Share this post


Link to post
Share on other sites

in the .bat put

file1.exe | file2.exe | file3.exe

and the 3 files will be started simultaniously

whereas

file1.exe
file2.exe
file3.exe

would cause file2.exe to be started after file1.exe closed.

[edit]

haven't tested this using an iexpress package though.

[/edit]

Edited by DanielG
1

Share this post


Link to post
Share on other sites

As far as I can remember, if you start exes via a shortcut in a batch file, it should load them all at once, although piping as shown above seems easier :)

0

Share this post


Link to post
Share on other sites

Thanks, I tried the piping just now and it does not work with iexpress. Weird. Thanks.

0

Share this post


Link to post
Share on other sites

too bad

[edit]

after seeing your tutorial i've been messing around with Iexpress.

I've found a way to start the 2 files at the same time but it requires cmd.exe (which is on XP anyways).

post-4947-1158160477_thumb.jpg

The command in the second picture is "cmd.exe /C file1|file2|file3" etc.

The "hidden" option in the third picture is because it will hide the command prompt window when cmd.exe is called.

Edited by DanielG
0

Share this post


Link to post
Share on other sites

Cool beans. Thanks much for looking into it.

0

Share this post


Link to post
Share on other sites

As far as I can remember, if you start exes via a shortcut in a batch file, it should load them all at once, although piping as shown above seems easier :)

Ya I use

start file.lnk

start file.lnk

start file.lnk

and the "start" command sometimes will just open up a cmd window I dont know what causes it something about the exe.

You can also check out CAX.EXE

I am a total noob so I use winbatch for silly apps

CAX.EXE owns all ...

0

Share this post


Link to post
Share on other sites

Irongeek: Thanks for making your vids available. Very interesting stuff.

Refining it futher:

cmd /C start notepad | start mspaint

This will allow cmd.exe to exit so that it won't appear in task manager

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now