Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
LemonWiki共筆
Search
Search
Appearance
Log in
Personal tools
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Sleep
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Approach 1: %RANDOM% + ping local === Purpose * Sleep random seconds between 5 ~ 60 seconds BAT file: <syntaxhighlight lang="Windows batch files"> REM print current date & time ECHO %date% %time% REM sleep 5 ~ 60 seconds SET /a timeout=%RANDOM% * 55 / 32767 + 5 ping 127.0.0.1 -n %timeout% > nul REM print current date & time ECHO %date% %time% </syntaxhighlight> Instruction<ref>[https://stackoverflow.com/questions/8258087/bat-random-timeout batch file - .bat random timeout - Stack Overflow]</ref> * {{kbd | key=<nowiki>%RANDOM%</nowiki>}} returns an integer between 0 and 32767<ref>[https://ss64.com/nt/syntax-random.html Random Numbers - Windows CMD - SS64.com]</ref>. * 55 is the range of values you want: 5 to 60. * 32767 is the range of values returned by {{kbd | key=<nowiki>%RANDOM%</nowiki>}} (0 to 32767). * 5 is the minimum value you want. The original range of values is '0 to 55'. After plus 5 the range became '5 ~ 65'. * ping local address: {{kbd | key=<nowiki>/n <Count></nowiki>}} "Specifies the number of echo Request messages sent. The default is 4."<ref>[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/ping time]</ref><ref>[https://stackoverflow.com/questions/735285/how-to-wait-in-a-batch-script windows xp - How to wait in a batch script? - Stack Overflow]</ref>
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki共筆:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)