Go Back   TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



batch file to open 2 progs with time delay

Windows XP Support


Reply
 
Thread Tools Search this Thread
  #1  
Old 17-09-2007
Member
 
Join Date: Jul 2006
Posts: 442
batch file to open 2 progs with time delay

Can anyone tell me how to write a batch file to open 2 programs, the first to open immediately and the second one with a 20 second delay after the first one? Like for example, I would like to open Google Earth first and then want to open another programs Event Manager 20 seconds after Google Earth? How can I do that? Thanks.

Reply With Quote
  #2  
Old 18-09-2007
Member
 
Join Date: Oct 2005
Posts: 449
Re: batch file to open 2 progs with time delay

You can try to start a script file from the bat file, and use the argument to wait till it returns. This could be a script that waits 20 seconds before returning.

---example.bat--
start first.exe
start /wait myscript.vbs
start second.exe
--end file--

--myscript.vbs
wscript.sleep 20000
--end file--
Reply With Quote
  #3  
Old 18-09-2007
Member
 
Join Date: Oct 2004
Posts: 1,342
RE: batch file to open 2 progs with time delay

I dont think it is possible by batch commands, but a very simple script will do this:

; Delay.au3
; Compile with AutoIt 3.x, http://www.techarena.in
; Usage in batch: Delay {seconds}

Opt ("TrayIconHide",1)

if $cmd[0] > 0 then
$thisDelay=$cmd[1] * 1000
sleep($thisDelay)
endif
exit
Reply With Quote
  #4  
Old 18-09-2007
Member
 
Join Date: Jan 2006
Posts: 605
You can try to copy and paste the below into notepad (don't use Word or Wordpad) and save it as "Abc.bat"

start "C:\Program Files\Google\Google Earth Pro\googleearth.exe"
echo wscript.sleep 20000 > temp.vbs
start /wait temp.vbs
start "C:\Documents and Settings\Andrew\Desktop\DUMP\EventManager\EventManager.exe"
del temp.vbs
Reply With Quote
  #5  
Old 19-12-2009
Member
 
Join Date: Jan 2006
Posts: 4,545
You can try to use a visual basic script instead. Just copy and paste the below in notepad and save it as "Abc.vbs":

dim oShell
Set oShell=WScript.CreateObject("WScript.Shell")

oShell.Run "calc.exe",1,false
wscript.sleep 20000
oShell.Run "notepad.exe",1,false

If it works, replace "calc.exe" and "notepad.exe" with your complete programs' paths and names.
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "batch file to open 2 progs with time delay"
Thread Thread Starter Forum Replies Last Post
Learning Batch file to open a program or a file Ikshana Windows Software 3 04-04-2011 07:24 PM
How to run batch file at specific time Campbel Software Development 4 27-03-2010 07:32 PM
How to run batch file each time computer boots Gannon Software Development 4 27-03-2010 05:53 PM
Is it possible to right click on cmd batch file and try to open it in a directory Kamran Operating Systems 2 26-05-2009 10:41 AM
Date and Time format in a BATCH File RogerFielden Software Development 3 20-04-2009 11:47 AM


All times are GMT +5.5. The time now is 02:01 PM.