Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Batch file pause

  • 05-03-2005 6:27pm
    #1
    Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭


    Hi,
    Basically I need to write a batch file that will, say ping Google once every hour. I'm grand with basic batch files, but is there a command to pause the file for a set period of time?

    If not, is there any other method by which I could flick back easily to see if and when a client was detached from the network?

    Thank You
    Snapscan


Comments

  • Registered Users, Registered Users 2 Posts: 11,987 ✭✭✭✭zAbbo


    ping www.google.ie -w 60000

    or something


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    That doesn't do it - it just extends the time PING waits for a reply before claiming that the packet was lost.
    Thanks anyway

    Any more ideas?


  • Registered Users, Registered Users 2 Posts: 11,987 ✭✭✭✭zAbbo


    stick a wait in there, theres plenty of info, google


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 93,582 Mod ✭✭✭✭Capt'n Midnight


    Use Choice.com from Dos/Win9x - works on later versions of windows too.

    choice /T:Y,99

    Note: only waits up to 99 seconds
    There are probably a couple of thousand utils like this out there,
    including the ones on the windows Resource kits " wait "

    To see when the connection was lost - debug this
    [php]:loop
    ping x -n | find "No Reply"
    if errorlevel 1 goto loop
    echo. | time >>timeout.txt
    goto loop[/php]


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    Wait doesn't exist, and choice.com isn't available (Win XP Pro SP2)

    I looked at google, but came up with nothing.
    Is there any other methods or stand-alone programs?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 6,762 ✭✭✭WizZard


    Set up a scheduled job in Windows? Set it to run your batch file every hour at whatever time, then get your batch file to output to a file.

    <edit>Just noticed that windows smallest time period for a scheduled task is 24hrs. So it's not good. </edit>


  • Registered Users, Registered Users 2 Posts: 78 ✭✭de8o


    You need sleep.exe. It comes with the resource CD but I think M$ allow you to download it now. Works great in batch files.


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    I'll write you an app that does it. I can do it on Wednesday. If you have perl installed I'll write you a script now.

    Edit: I have a copy of sleep here. pm me your email address and I'll send it to you. I take no responsibility if it wrecks your computer, etc. etc.


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    Savage! Cheers de80


  • Registered Users, Registered Users 2 Posts: 1,065 ✭✭✭Snowbat


    You can also find a sleep.exe here (3rd file):
    http://www.computerhope.com/dutil.htm


  • Advertisement
  • Moderators, Arts Moderators Posts: 35,731 Mod ✭✭✭✭pickarooney


    copy these two lines into a file called wait.bat and save it in a directory which is in your PATH
    @ping 127.0.0.1 -n 2 -w 1000 > nul
    @ping 127.0.0.1 -n %1% -w 1000> nul
    

    To use it in a batch file just call wait n where n is the number of seconds.

    Note: the ping command here is not actually used for the pinging you want to do, it's simply pinging the machine itself (or a null address would work equally well) and creating the delay.


Advertisement