Errorlevel value. If you press Ctrl + break or Ctrl + C, the tool returns 0
The errorlevel value. When the errorlevel parameter is used in a batch program
Sort in sequence.
Example:
Choice /?
For choice/c ync/m ", Press Y, N, or C. "
Choice/T 10/c ync/CS/d y
Select a for choice/c AB/M "option 1 and B for option 2. "
Choice/c AB/N/m "option 1 select a, option 2 select B. "
If I run the command: choice/c ync/M "OK, Press Y, N, or cancel to press C. "
The screen displays:
Press Y to confirm, N to
warning. If the tool detects an error, it returns the errorlevel value of 255. If you press Ctrl + break or Ctrl + C, the tool returns the errorlevel value of 0. When the errorlevel parameter is used in a batch program, the parameters are sorted in descending order.
Example:
Choice /?
For choice/c ync/m ", Press Y, N, or C. "
Choice/T 10/c ync/CS/d y
Select a for choice/c AB/M "option 1 and B for option 2. "
Choice/c AB/N/m "option 1 select a, option 2 select B. "
If I run the command: choice/c
users to enter a single character to run different commands. The/c: parameter should be added for use, and c: should be followed by a prompt to enter characters without spaces. Its return code is 1234 ......For example: choice/c: dimethyl defrag, mem, endWill displayDefrag, mem, end [D, M, E]?For example, the content of test. bat is as follows:@ Echo offChoice/c: dimethyl defrag, mem, endIf errorlevel 3 go
. Run the command. Otherwise, run the next sentence. For example, if exist config. sys edit config. sys
3. if errorlevel: command to be executedIf 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 DOS returns a number to DOS when running the program, which is called the error code errorlevel or return code.
When the goto batch file runs here, it will jump to the label specified by goto,
should be added for use, and C: should be followed by a prompt to enter characters without spaces. Its return code is 1234 ......For example: choice/C: dimethyl defrag, mem, endWill displayDefrag, mem, end [d, M, E]?Sample:The content of sample. bat is as follows:@ Echo offChoice/C: dimethyl defrag, mem, endIf errorlevel 3 goto defrag (the highest error code sho
priority categoryRealtime starts applications in the realtime priority categoryWait starts the application and waits for it to endParameters: these are parameters sent to the command/program.When the executed application is a 32-bit GUI application, cmd. EXE returns a command prompt before the application is terminated. If it is executed in the Command Script, the new behavior will not occur.8. Choice commandChoice uses this command to allow users to enter a single character to run different co
the endThe label is represented by a string. The row where the label is located is not executed.Choice uses this command to allow users to enter a single character to run different commands. The/C: parameter should be added for use, and C: should be followed by a prompt to enter characters without spaces. Its return code is 1234 ......For example: choice/C: dimethyl defrag, mem, endWill displayDefrag, mem, end [d, M, E]?For example, the content of te
example:
Goto end
: EndEcho this is the end
The label is represented by a string. The row where the label is located is not executed.
Choice uses this command to allow users to enter a single character to run different commands. The/C: parameter should be added for use, and C: should be followed by a prompt to enter characters without spaces. Its return code is 1234 ......
For example: choice/C: dimethyl defrag, mem, endWill displayDefrag,
simple, generally used with the if command.What is the label? Simply put, the name is preceded by a colon, for example, ExampleExample: {command1}
Goto somewhere
{Command2}
: SomewhereEcho "when you execute goto somewhere, command2 is skipped to execute this command"
---ChoiceYou can run different commands by entering a single character. The/C: parameter should be added for use,C: Enter the characters that can be entered. There is no space between them. Its return code is 1234 ......
For exampl
priority categoryREALTIME starts applications in the REALTIME priority categoryWAIT starts the application and waits for it to endParameters: these are parameters sent to the command/program.When the executed application is a 32-bit GUI application, CMD. EXE returns a command prompt before the application is terminated. If it is executed in the Command Script, the new behavior will not occur.8. choice commandChoice uses this command to allow users to enter a single character to run different co
high priority categoryRealtime starts applications in the realtime priority categoryWait starts the application and waits for it to endParameters: these are parameters sent to the command/program.
When the executed application is a 32-bit GUI application, cmd. EXE returns a command prompt before the application is terminated. If
.8. Choice command
Choice uses this command to allow users to enter a single character to run different commands. /C: parameter should be added for use, C: should
specified by Goto, which is generally used with if. For example:
Goto end
: EndEcho this is the end
The label is represented by a string. The row where the label is located is not executed.Choice uses this command to allow users to enter a single character to run different commands. The/C: parameter should be added for use, and C: should be followed by a prompt to enter characters without spaces. Its return code is 1234 ......
For example: choice/C: dimethyl
-bit GUI application, cmd. EXE returns a command prompt before the application is terminated. If it is executed in the Command Script, the new behavior will not occur.8. Choice commandChoice uses this command to allow users to enter a single character to run different commands. The/C: parameter should be added for use, and C: should be followed by a prompt to enter characters without spaces. Its return code is 1234 ......For example: choice/C: dimethyl defra
the start command.Common Intrusion parameters:Minimum window size when MIN startsSEPARATE starts a 16-bit Windows program in a SEPARATE spaceHIGH starts applications in the HIGH priority categoryREALTIME starts applications in the REALTIME priority categoryWAIT starts the application and waits for it to endParameters: these are parameters sent to the command/program.When the executed application is a 32-bit GUI application, CMD. EXE returns a command prompt before the application is terminated.
Windows programs in separate spacesHigh starts the application in the high priority categoryREALTIME starting the application in the REALTIME priority categoryWait to start the application and wait for it to endParameters these parameters for transmission to the command/programThe application that executes is a 32-bit GUI application when CMD. EXE returns a command prompt without waiting for the application to terminate. If executed within a command script, the new behavior does not occur.8.cho
selected from the selection set. The first selection listed returns 1, the second option returns 2, and so on. The tool emits a warning beep if the user presses a key that is not a valid selection. If the tool detects an error state, it returns a value of 255 errorlevel. If the user presses the Ctrl+break or CTRL + C key, the tool returns a value of 0 errorlevel. When you use the ERRORLEVEL parameter in a batch program, the arguments are sorted in descending order.
Example:
CHOICE/?
CHOICE/C y
if the user presses a key that is not a valid selection. If the tool detects an error state, it returns a value of 255 errorlevel. If the user presses the Ctrl+break or CTRL + C key, the tool returns a value of 0 errorlevel. When you use the ERRORLEVEL parameter in a batch program, the arguments are sorted in descending order.
Example:
CHOICE/?
CHOICE/C ync/m "Confirm please press Y, no please press N, or cancel please press C." "
choice/t 10/c ync/cs/d y
CHOICE/C ab/m Option 1 Please select a,
selection,
The tool emits a warning sound. If the tool detects an error state, it returns a 255
ERRORLEVEL value. If the user presses the Ctrl+break or CTRL + C key, the tool returns 0
the ERRORLEVEL value. When using the ERRORLEVEL parameter in a batch program, the parameter is dropped
Ordinal arrangement.
Example:
CHOICE/?
CHOICE/C ync/m "Confirm please press Y, no please press N, or cancel please press C." "
choice/t 10/c ync/cs/d y
CHOICE/C ab/m Option 1 Please select a, option 2, select B.
return value is ordered from high to low by the IF errorlevel):
@echo off
CHOICE/C dme/m "Defrag,mem,end"
if errorlevel 3 goto end
if errorlevel 2 goto MEM
If Errotlevel 1 goto defrag
:d Efrag
C:\dos\defrag
Goto END
: Mem
Mem
Goto END
: End
echo Good bye
After this batch is run, the "Defrag,mem,end[d,m,e]" is displaye
file named "Context_defrag.inf," and enter the following in the file:
; Context_defrag. Inf
; Adds Defrag to the right click context menu in Windows XP
[Version]
Signature= "$CHICAGO $"
[DefaultInstall]
Addreg=addme
[AddMe]
HKCR, "Drive\shell\defrag\command",,, "Defrag. EXE%1 "
Right-click the file after editing and choose Install, which is installed in Windows
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.