这是无聊时候看了下批处理文档写的,基本上实现了重启电脑的指定次数。缺点是只能放在桌面上跑还有就是不能绕过用户密码。在此只做参考,可以在此基础上继续完善
复制代码用记事本打开,保存为.bat档,使用Administrator运行。
@echo off
echo Author:Hama_Tago Time:2017/9/5echo ====================================
echo RE:Pelase Runing On The User\Desktop
echo ====================================
cd "%Userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
if exist 2.txt goto start
if exist log.log del log.log
if exist restart.bat del restart.bat
cd %Userprofile%\Desktop
copy restart.bat "%Userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
:start
cd %Userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
if not exist 1.txt goto set
if exist 2.txt for /F %%i in (2.txt) do set /a b=%%i
set /a b+=1
echo %b% >2.txt
for /F %%i in (1.txt) do set /a c=%%i
if %b% gtr %c% goto end
::restartecho %b% >>log.log
echo %date% %time% >>log.log
cd c:\windows\system32
shutdown -r -t 0
pause >nul
del 1.txt
del 2.txt
del restart.bat
copy log.bat "%Userprofile%\Disktop"
:set
echo ===================================
echo [pelase input the times of Restart]
echo ===================================
set /p a=
echo %a% >1.txt
goto start
更多推荐
实现电脑重启指定次数的bat
发布评论