Editing
Sleep in Mandarin
(section)
Jump to navigation
Jump to search
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!
=== 方法 1:使用 %RANDOM% 加上 ping 本地 === 目的 * 在 5 到 60 秒之間隨機暫停 批處理檔案: <pre> REM 列印當前日期與時間 ECHO %date% %time% REM 暫停 5 到 60 秒 SET /a timeout=%RANDOM% * 55 / 32767 + 5 ping 127.0.0.1 -n %timeout% > nul REM 列印當前日期與時間 ECHO %date% %time% </pre> 說明<ref>[https://stackoverflow.com/questions/8258087/bat-random-timeout 批處理檔案 - .bat 隨機暫停時間 - Stack Overflow]</ref> * {{kbd | key=<nowiki>%RANDOM%</nowiki>}} 會返回一個介於 0 和 32767 之間的整數<ref>[https://ss64.com/nt/syntax-random.html 隨機數字 - Windows 命令 - SS64.com]</ref>。 * 55 是你想要的範圍:5 到 60。 * 32767 是由 {{kbd | key=<nowiki>%RANDOM%</nowiki>}} 返回的數值範圍(0 到 32767)。 * 5 是你想要的最小值。原始數值範圍是「0 到 55」。加上 5 之後範圍變成了「5 到 60」。 * ping 本地地址:{{kbd | key=<nowiki>/n <Count></nowiki>}} "指定發送的回聲請求消息數量。預設值是 4。"<ref>[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/ping 時間]</ref><ref>[https://stackoverflow.com/questions/735285/how-to-wait-in-a-batch-script windows xp - 如何在批處理腳本中等待? - 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)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information