Jump to content

wait/sleep between running two commands in a BATCH file.


Recommended Posts

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

Link to comment
Share on other sites


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

[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]

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

  • 3 weeks later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...