Jump to content


Photo
- - - - -

Batch Files: Run exes asynchronously


  • Please log in to reply
11 replies to this topic

#1 Irongeek

Irongeek

    Dangerous free thinker

  • Agents of the Revolution
  • 1,516 posts
  • Location:Louisville, Ky more or less

Posted 07 September 2006 - 03:22 PM

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?
  • carpinteyrodzt likes this

#2 fatal

fatal

    I broke 10 posts and all I got was this lousy title!

  • Members
  • 14 posts

Posted 07 September 2006 - 06:54 PM

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
  • carpinteyrodzt likes this

#3 Irongeek

Irongeek

    Dangerous free thinker

  • Agents of the Revolution
  • 1,516 posts
  • Location:Louisville, Ky more or less

Posted 07 September 2006 - 07:12 PM

Thanks, I'll give that a shot.
  • carpinteyrodzt likes this

#4 Irongeek

Irongeek

    Dangerous free thinker

  • Agents of the Revolution
  • 1,516 posts
  • Location:Louisville, Ky more or less

Posted 08 September 2006 - 10:13 AM

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.
  • carpinteyrodzt likes this

#5 DanielG

DanielG

    SUP3R 31337 P1MP

  • Members
  • 294 posts
  • Location:The Netherlands

Posted 08 September 2006 - 10:51 AM

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, 08 September 2006 - 10:55 AM.

  • carpinteyrodzt likes this

#6 woodys_world69

woodys_world69

    The phorce is with me!

  • Members
  • 70 posts

Posted 08 September 2006 - 10:56 AM

yeah that piping works by itself, very good stuff!

#7 n0x

n0x

    SUP3R 31337 P1MP

  • Members
  • 261 posts

Posted 08 September 2006 - 11:15 AM

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 :)

#8 Irongeek

Irongeek

    Dangerous free thinker

  • Agents of the Revolution
  • 1,516 posts
  • Location:Louisville, Ky more or less

Posted 08 September 2006 - 12:02 PM

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

#9 DanielG

DanielG

    SUP3R 31337 P1MP

  • Members
  • 294 posts
  • Location:The Netherlands

Posted 08 September 2006 - 12:06 PM

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).

Attached File  iexpress.gif   31.04KB   290 downloads

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, 13 September 2006 - 10:21 AM.


#10 Irongeek

Irongeek

    Dangerous free thinker

  • Agents of the Revolution
  • 1,516 posts
  • Location:Louisville, Ky more or less

Posted 13 September 2006 - 10:39 AM

Cool beans. Thanks much for looking into it.

#11 operat0r

operat0r

    Dangerous free thinker

  • Members
  • 793 posts
  • Location:ops

Posted 14 September 2006 - 01:32 AM

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 ...

#12 v1l3man

v1l3man

    Will I break 10 posts?

  • Members
  • 3 posts

Posted 29 October 2006 - 05:13 PM

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




BinRev is hosted by the great people at Lunarpages!