Several shutdown, restart the script of the NT system (timing execution shutdown task)

xiaoxiao2021-03-06  68

1.Reboot restart script (reboot.bat): @ echo offsetlocalcd / d% temp% echo [version]> reboot.infset inf = InstallHinfSection DefaultInstallecho signature = $ chicago $ >> reboot.infecho [defaultinstall] >> reboot.infrundll32 setupapi % INF% 1% temp% / reboot.infdel reboot.inf2. Shutdown.bat: @ echo off% echo set coloringsystems = getObject ("WinMgmts: {(Shutdown)}") .ExecQuery ( "Select * from Win32_OperatingSystem")> shutdown.vbsecho For Each objOperatingSystem in colOperatingSystems >> shutdown.vbsecho ObjOperatingSystem.Win32Shutdown (8) >> shutdown.vbsecho Next >> shutdown.vbscscript shutdown.vbsdel shutdown.vbs3. shutdown script (shutdown1.vbs): Set colOperatingSystems = GetObject ( "winmgmts: {(Shutdown)}"). ExecQuery ( "Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems ObjOperatingSystem.Win32Shutdown (8) Next 4. delay 60 seconds Prompt before shutdown, cancel the shutdown before delay (shutdown2.vbs script): set wshshell = createObject ("wscript.shell") Timeout = 60 'Time OUT You can define your own ask = "system will be in" & Timeout & "After a second, shut down!" title = "prompt automatic shutdown" constants = vbExclamation vbOkCancel result = wshshell.Popup (ask, timeout, title, constants) if result = vbCancel then elseif result = true then Set colOperatingSystems = GetObject ( "winmgmts: {(Shutdown)}" ) .ExecQuery ( "Select * from Win32_OperatingSystem") for Each objOperatingSystem in colOperatingSystems ObjOperatingSystem.Win32Shutdown (8) Next end if Tip 1: save the above script for the corresponding files can be directly run, also put in a scheduled task execution timing . When the parameter in Win32ShutDown () is 1, it will not be completely powered up, and it will be displayed: Now you can safely turn off your computer.

转载请注明原文地址:https://www.9cbs.com/read-109339.html

New Post(0)