第1个回答 2009-12-04
@echo off
color f0
set b=%1
if "%b%"=="q" goto quit
if "%b%"=="0" goto thread
set /a a=%b%
:check
if "%a%"=="0" set /a a=-1
if %a% GEQ 0 goto thread
echo 需要手动输入时间。
set /p b=输入时间(单位:毫秒)
if "%b%"=="q" goto quit
if "%b%"=="0" goto thread
set /a a=%b%
goto check
:thread
shutdown /s /t %a%
set /a a=-1
:quit
pause
保存为bat文件。
或者:
set wshshell = createobject("wscript.shell")
k=wscript.arguments(0)
runa(k)
function runa(a)
if not IsNumeric(a) then
a=inputbox("输入时间(单位:分钟),[取消]或'无输入'退出脚本。")
if a="" then exit function
runa(a)
else
if cint(a)>=0 then
'msgbox a+1
wshshell.run "cmd.exe /c " & """" & "shutdown -s -t " & a*60 & """",0
end if
end if
end function
保存为vbs文件。