PC Review


Reply
Thread Tools Rate Thread

Windows XP Sleep Command

 
 
Steven Adams
Guest
Posts: n/a
 
      28th Dec 2003
Sorry couldn't find a windows XP group to post this to !.

Under a default Windows XP install there doesn't seem to be a sleep command
available at the command prompt ?
Has this been replaced or just removed.
I need to pause the execution of a script for a period of time in an
automated way.
any ideas ?

thanks,

Steve


 
Reply With Quote
 
 
 
 
Matthias Tacke
Guest
Posts: n/a
 
      28th Dec 2003
"Steven Adams" wrote:

>Sorry couldn't find a windows XP group to post this to !.
>
>Under a default Windows XP install there doesn't seem to be a sleep command
>available at the command prompt ?
>Has this been replaced or just removed.
>I need to pause the execution of a script for a period of time in an
>automated way.
>any ideas ?
>

There is a sleep in w2k reskit which isn't free.

When networking/tcp installes use as an alternative:

ping -n xx 127.0.0.1 >NUL

where xx is the number of seconds to pause.

--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm
 
Reply With Quote
 
Paul R. Sadowski
Guest
Posts: n/a
 
      28th Dec 2003
As far as I know sleep has never been part of the standard OS but is in the
resource kit.

There are also freeware sleep.exe around the web.

Here's two methods without going to an additional prog.
--------------------------------------------------------------------------------
call sleep 10
:sleep
:: sleep for x number of seconds
ping -n %1 127.0.0.1 > NUL 2>&1
goto :EOF
--------------------------------------------------------------------------------
cscript sleep.vbs 10

where sleep.vbs is:
args = wScript.Arguments.Count
if args <> 1 then
wscript.Echo "usage: " & Wscript.ScriptName & " seconds to sleep" & _
vbCRLF & "Example: " & Wscript.ScriptName & " 10"
wscript.Quit
end if
wscript.sleep wscript.Arguments.Item(0) * 1000
--------------------------------------------------------------------------------
Problems:
firewalls could screwup ping either by disallowing it or by not being
configured for it and asking the user for what to do with it.

sleep.vbs is not accurate because it may take a couple of second to
initialize. So 10 second delay might be 12 or even 13. Also, anti-virus
programs can be set to block scripts and some people even change the
scripting associations.

But if you know the machine(s) then these might do, or not. Only you can
decide.

"Steven Adams" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Sorry couldn't find a windows XP group to post this to !.
>
> Under a default Windows XP install there doesn't seem to be a sleep
> command
> available at the command prompt ?
> Has this been replaced or just removed.
> I need to pause the execution of a script for a period of time in an
> automated way.
> any ideas ?
>
> thanks,
>
> Steve
>
>



 
Reply With Quote
 
Clay Calvert
Guest
Posts: n/a
 
      29th Dec 2003
On Sun, 28 Dec 2003 16:17:23 -0500, "Paul R. Sadowski"
<(E-Mail Removed)> wrote:

>call sleep 10
>:sleep
>:: sleep for x number of seconds
>ping -n %1 127.0.0.1 > NUL 2>&1
>goto :EOF


>Problems:
>firewalls could screwup ping either by disallowing it or by not being
>configured for it and asking the user for what to do with it.


Pinging 127.0.0.1, actually any address starting with 127, will not
cause any IP packets to leave the computer, much less hit any
firewall. The 127 range contains only loopback addresses. Try
unplugging the network connection and then running the script.
Replies will still happen.

Also note that to be closer to accurate that the parameter should be
one larger. In other words to sleep for 10 seconds use the following:

ping -n 11 127.0.0.1 >NUL

It doesn't make that much difference, but it could.

Clay Calvert
(E-Mail Removed)
Replace "W" with "L"
 
Reply With Quote
 
Paul R. Sadowski
Guest
Posts: n/a
 
      29th Dec 2003
"Clay Calvert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Pinging 127.0.0.1, actually any address starting with 127, will not
> cause any IP packets to leave the computer, much less hit any
> firewall.


I'm talking about software firewalls. I don't like them but had to test one
and pinging the localhost did set off the warning asking me whether to allow
it or not.


 
Reply With Quote
 
Clay Calvert
Guest
Posts: n/a
 
      29th Dec 2003
On Sun, 28 Dec 2003 21:05:11 -0500, "Paul R. Sadowski"
<(E-Mail Removed)> wrote:

>"Clay Calvert" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> Pinging 127.0.0.1, actually any address starting with 127, will not
>> cause any IP packets to leave the computer, much less hit any
>> firewall.

>
>I'm talking about software firewalls. I don't like them but had to test one
>and pinging the localhost did set off the warning asking me whether to allow
>it or not.


Gotcha. Good point.


Clay Calvert
(E-Mail Removed)
Replace "W" with "L"
 
Reply With Quote
 
Joe Richards [MVP]
Guest
Posts: n/a
 
      30th Dec 2003
jsleep on the free win32 tools page of www.joeware.net


--
Joe Richards
www.joeware.net

--

"Steven Adams" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> Sorry couldn't find a windows XP group to post this to !.
>
> Under a default Windows XP install there doesn't seem to be a sleep command
> available at the command prompt ?
> Has this been replaced or just removed.
> I need to pause the execution of a script for a period of time in an
> automated way.
> any ideas ?
>
> thanks,
>
> Steve
>
>



 
Reply With Quote
 
Timo Salmi
Guest
Posts: n/a
 
      30th Dec 2003
"Steven Adams" <(E-Mail Removed)> wrote:
> Under a default Windows XP install there doesn't seem to be a sleep command
> available at the command prompt ?


19} How can one build a delay / sleep / wait procedure for a script?

56675 Dec 27 2003 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
private.php?do=newpm&u= <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html
 
Reply With Quote
 
Paul R. Sadowski
Guest
Posts: n/a
 
      30th Dec 2003
Here's mine. Unfortunately my host is now disallowing exe's so I had to zip
it.
http://paulsadowski.com/scripts/down...p?fn=sleep.zip

C:\bin [(firecat) 15:14, Tue 12/30/2003] sleep
sleep: sleep-time-in-seconds


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sleep command Bill Walsh Windows Vista Performance 2 3rd Dec 2009 06:08 PM
wait/sleep command yepiknowiam Windows XP General 8 13th Jun 2008 06:11 PM
Sleep mode command Sam Steinhauser Windows Vista General Discussion 3 26th Jan 2008 12:46 AM
Windows Scheduler Latency after WinAPI "Sleep"-Command or Timers John Lafrowda Windows XP General 5 15th Feb 2006 06:03 PM
Windows Scheduler Latency after WinAPI "Sleep"-Command or Timers John Lafrowda Windows XP Hardware 5 15th Feb 2006 06:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:16 AM.