Board logo

标题: [文本处理] 大神帮帮我输入多少秒后重启的批处理 [打印本页]

作者: qkhhha    时间: 2022-1-19 18:05     标题: 大神帮帮我输入多少秒后重启的批处理

读秒后 自动重启没问题 按任意键 输入多少秒 重启 有问题
  1. @echo off
  2. set tt=12
  3. if not "%1"=="" goto %1
  4. del /f "%temp%\#" 2>nul
  5. start /b "" "%~f0" :count
  6. pause
  7. >"%temp%\#" type nul
  8. exit
  9. :count
  10. if %tt%==0 (
  11. shutdown /r /t 0
  12. for /f "tokens=2" %%a in ('tasklist /fi "imagename eq cmd.exe" /nh') do (taskkill /f /pid %%a>nul)
  13. exit
  14. )
  15. if exist "%temp%\#" (
  16. del "%temp%\#"
  17. set /p sj=请输入多少秒后重启:
  18. shutdown /r /t %sj%
  19. exit
  20. )
  21. cls&echo 在英文输入法状态下按任意键可退出
  22. echo 倒数%tt%秒后将自动关闭计算机!
  23. ping -n 2 127.1>nul
  24. set /a tt-=1
  25. goto :count
复制代码

作者: Batcher    时间: 2022-1-19 19:14

回复 1# qkhhha


这样可以吗:
  1. @echo off
  2. set "InputSec=12"
  3. set /p "InputSec=请输入多少秒后重启:"
  4. shutdown /r /t %InputSec%
复制代码

作者: qkhhha    时间: 2022-1-19 19:52

这样无法读秒呀  我要的效果是  读秒自动重启 按任意键可以设置时间重启




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2