PC Review Forums Newsgroups Windows 2000 Microsoft Windows 2000 CMD Promt Windows XP Sleep Command

Reply

Windows XP Sleep Command

 
Thread Tools Rate Thread
Old 28-12-2003, 09:14 PM   #1
Steven Adams
Guest
 
Posts: n/a
Default Windows XP Sleep Command


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
Old 28-12-2003, 09:58 PM   #2
Matthias Tacke
Guest
 
Posts: n/a
Default Re: Windows XP Sleep Command

"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
Old 28-12-2003, 10:17 PM   #3
Paul R. Sadowski
Guest
 
Posts: n/a
Default Re: Windows XP Sleep Command

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" <steven.adams@nospam.co.nz> wrote in message
news:%230CH48XzDHA.1740@TK2MSFTNGP09.phx.gbl...
> 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
Old 29-12-2003, 02:16 AM   #4
Clay Calvert
Guest
 
Posts: n/a
Default Re: Windows XP Sleep Command

On Sun, 28 Dec 2003 16:17:23 -0500, "Paul R. Sadowski"
<xpert@mailshell13.mailshell.com> 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
CCalvert@Wanguru.com
Replace "W" with "L"
  Reply With Quote
Old 29-12-2003, 03:05 AM   #5
Paul R. Sadowski
Guest
 
Posts: n/a
Default Re: Windows XP Sleep Command

"Clay Calvert" <ccalvert@Wanguru.com> wrote in message
news:cmuuuv4sajvprfaulq9a7gscrpttk2cj3j@4ax.com...
> 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
Old 29-12-2003, 03:10 AM   #6
Clay Calvert
Guest
 
Posts: n/a
Default Re: Windows XP Sleep Command

On Sun, 28 Dec 2003 21:05:11 -0500, "Paul R. Sadowski"
<xpert@mailshell13.mailshell.com> wrote:

>"Clay Calvert" <ccalvert@Wanguru.com> wrote in message
>news:cmuuuv4sajvprfaulq9a7gscrpttk2cj3j@4ax.com...
>> 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
CCalvert@Wanguru.com
Replace "W" with "L"
  Reply With Quote
Old 30-12-2003, 01:32 AM   #7
Joe Richards [MVP]
Guest
 
Posts: n/a
Default Re: Windows XP Sleep Command

jsleep on the free win32 tools page of www.joeware.net


--
Joe Richards
www.joeware.net

--

"Steven Adams" <steven.adams@nospam.co.nz> wrote in message news:%230CH48XzDHA.1740@TK2MSFTNGP09.phx.gbl...
> 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
Old 30-12-2003, 07:37 PM   #8
Timo Salmi
Guest
 
Posts: n/a
Default Re: Windows XP Sleep Command

"Steven Adams" <steven.adams@nospam.co.nz> 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
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html
  Reply With Quote
Old 30-12-2003, 09:17 PM   #9
Paul R. Sadowski
Guest
 
Posts: n/a
Default Re: Windows XP Sleep Command

Here's mine. Unfortunately my host is now disallowing exe's so I had to zip
it.
http://paulsadowski.com/scripts/dow...sp?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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off