给楼主提供一个参考代码——倒数十秒,若无输入则开始备份:- @echo off
- echo %cmdcmdline%
- if "%~1"=="按任意键退出" goto :%1
- >"%temp%\.sub" cd.
- start "" /b %0 按任意键退出
- set 退格键=
-
- for /l %%a in (10 -1 1) do (
- set /p =%退格键%%%a 秒后开始备份文件... [按任意键退出] <nul
- if not exist "%temp%\.sub" exit
- ping -n 2 127.1 >nul
- )
-
- echo,
- echo 备份完成。
-
- echo 按任意键退出...
- exit
-
- :按任意键退出
- pause >nul
- del "%temp%\.sub"
- exit
复制代码
|