如何使这个BATch文件有一个计时器(剩余时间关闭或重置)?(How to make this BATch file have a timer (time left to shutdown or re

编程入门 行业动态 更新时间:2024-10-19 17:45:02
如何使这个BATch文件有一个计时器(剩余时间关闭或重置)?(How to make this BATch file have a timer (time left to shutdown or reset)?)

如何使这个BATch文件有一个计时器? 想看看剩下多少时间。 Windows只会说“Windows将在不到一分钟内关闭”。

@echo off color 0A title Restart\/Shutdown :start echo Welcome, %USERNAME% echo What would you like to do? echo. echo 1. Shut down echo 2. Restart echo. echo 0. Quit echo. set /p choice="Enter your choice: " if "%choice%"=="1" goto shutdown if "%choice%"=="2" goto restart if "%choice%"=="0" exit echo Invalid choice: %choice% echo. pause cls goto start :shutdown shutdown.exe -s -t 10 :restart shutdown.exe -r -t 10

How to make this BATch file have a timer? Would like to see how much time left. Windows only says "Windows will shut down in less then a minute".

@echo off color 0A title Restart\/Shutdown :start echo Welcome, %USERNAME% echo What would you like to do? echo. echo 1. Shut down echo 2. Restart echo. echo 0. Quit echo. set /p choice="Enter your choice: " if "%choice%"=="1" goto shutdown if "%choice%"=="2" goto restart if "%choice%"=="0" exit echo Invalid choice: %choice% echo. pause cls goto start :shutdown shutdown.exe -s -t 10 :restart shutdown.exe -r -t 10

最满意答案

你可以使用命令“timeout / t 10”或类似的东西:

@ECHO OFF FOR /L %%# IN (10,-1,1) DO (SET/P "=%%# seconds left... "<NUL: PING -n 2 127.0.0.1 >NUL CLS:)

You could use the command "timeout /t 10" or something like:

@ECHO OFF FOR /L %%# IN (10,-1,1) DO (SET/P "=%%# seconds left... "<NUL: PING -n 2 127.0.0.1 >NUL CLS:)

更多推荐

本文发布于:2023-08-04 10:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415276.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:计时器   剩余时间   有一个   文件   BATch

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!