实现电脑重启指定次数的bat

    这是无聊时候看了下批处理文档写的,基本上实现了重启电脑的指定次数。缺点是只能放在桌面上跑还有就是不能绕过用户密码。在此只做参考,可以在此基础上继续完善大笑

复制代码用记事本打开,保存为.bat档,使用Administrator运行。


@echo off

echo    Author:Hama_Tago Time:2017/9/5

echo  ====================================
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

::restart
  echo %b% >>log.log
  echo %date% %time% >>log.log
  cd c:\windows\system32
  shutdown -r -t 0

  pause >nul


:end
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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值