MSFN Forum: wait/sleep between running two commands in a BATCH file. - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

wait/sleep between running two commands in a BATCH file. Rate Topic: -----

#1 User is offline   idealone 

  • Group: Members
  • Posts: 6
  • Joined: 05-February 08

Posted 04 March 2008 - 07:46 AM

Hi guys,
I need to use sleep or wait for few seconds between commands, i am using win XP, so i read that sleep command is not recognized, they say ping command works...but not sure how to use it!!
So can anyone lighten me up whats the best way to solve this issue..

batch file:

start /b java -jar Y:\selenium-server-0.9.2/selenium-server.jar #this command starts my server

# (I would want to wait/sleep for 20 or 30 seconds before going to next command)

start /b run myfile.exe # this is my second command to run my program


Thanks in Advance


#2 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,019
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 04 March 2008 - 09:21 AM

View Postidealone, on Mar 4 2008, 03:46 PM, said:

Hi guys,
I need to use sleep or wait for few seconds between commands, i am using win XP, so i read that sleep command is not recognized, they say ping command works...but not sure how to use it!!
So can anyone lighten me up whats the best way to solve this issue..

batch file:

start /b java -jar Y:\selenium-server-0.9.2/selenium-server.jar #this command starts my server

# (I would want to wait/sleep for 20 or 30 seconds before going to next command)

start /b run myfile.exe # this is my second command to run my program


Thanks in Advance


Try this

Quote

[code]@Echo Off
CLS
Mode 55,7
Color F9
Title Connect To Server
start /b java -jar Y:\selenium-server-0.9.2/selenium-server.jar
Echo.
Echo Processing Please Wait......
ping -n 30 127.0.0.1>nul
start /b run myfile.exe[/code]


#3 User is offline   idealone 

  • Group: Members
  • Posts: 6
  • Joined: 05-February 08

Posted 05 March 2008 - 11:41 PM

View Postgunsmokingman, on Mar 4 2008, 10:21 AM, said:

View Postidealone, on Mar 4 2008, 03:46 PM, said:

Hi guys,
I need to use sleep or wait for few seconds between commands, i am using win XP, so i read that sleep command is not recognized, they say ping command works...but not sure how to use it!!
So can anyone lighten me up whats the best way to solve this issue..

batch file:

start /b java -jar Y:\selenium-server-0.9.2/selenium-server.jar #this command starts my server

# (I would want to wait/sleep for 20 or 30 seconds before going to next command)

start /b run myfile.exe # this is my second command to run my program


Thanks in Advance


Try this

Quote

[code]@Echo Off
CLS
Mode 55,7
Color F9
Title Connect To Server
start /b java -jar Y:\selenium-server-0.9.2/selenium-server.jar
Echo.
Echo Processing Please Wait......
ping -n 30 127.0.0.1>nul
start /b run myfile.exe[/code]



Thanks for your reply,
Is there any other means of waiting apart from ping, as using ping command is blocked in my company.

#4 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 05 March 2008 - 11:50 PM

Yes, take a look at this!

#5 User is offline   idealone 

  • Group: Members
  • Posts: 6
  • Joined: 05-February 08

  Posted 09 March 2008 - 11:02 PM

View PostYzöwl, on Mar 5 2008, 11:50 PM, said:

Yes, take a look at this!


Super
GREAT WORK!!!!!

#6 User is offline   war59312 

  • Will's Blog
  • PipPipPipPipPip
  • Group: Members
  • Posts: 922
  • Joined: 07-June 02

Posted 29 March 2008 - 08:23 PM

timeout.exe is easy enough..

Moderator Note
The non-Microsoft download link has been removed, the Windows NT Resource Kit which contains this utility is available directly from Microsoft.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy