text
stringlengths
0
4.23k
<compareop>
Specifies a three-letter comparison operator, including:EQU - Equal toNEQ - Not equal toLSS - Less thanLEQ - Less than or equal toGTR - Greater thanGEQ - Greater than or equal to
/i
Forces string comparisons to ignore case. You can use /i on the string1==string2 form of if. These comparisons are generic, in that if both string1 and string2 are comprised of numeric digits only, the strings are converted to numbers and a numeric comparison is performed.
cmdextversion <number>
Specifies a true condition only if the internal version number associated with the command extensions feature of Cmd.exe is equal to or greater than the number specified. The first version is 1. It increases by increments of one when significant enhancements are added to the command extensions. The cmdextversion condit...
defined <variable>
Specifies a true condition if variable is defined.
<expression>
Specifies a command-line command and any parameters to be passed to the command in an else clause.
/?
Displays help at the command prompt.
<number>
<command>
<string1>==<string2>
%1
<filename>
<compareop>
string1==string2
<number>
<variable>
<expression>
Remarks
If the condition specified in an if clause is true, the command that follows the condition is carried out. If the condition is false, the command in the if clause is ignored and the command executes any command that is specified in the else clause.
When a program stops, it returns an exit code. To use exit codes as conditions, use the errorlevel parameter.
If you use defined, the following three variables are added to the environment: %errorlevel%, %cmdcmdline%, and %cmdextversion%.
%errorlevel%: Expands into a string representation of the current value of the ERRORLEVEL environment variable. This variable assumes that there isn't already an existing environment variable with the name ERRORLEVEL. If there is, you'll get that ERRORLEVEL value instead.
%cmdcmdline%: Expands into the original command line that was passed to Cmd.exe prior to any processing by Cmd.exe. This assumes that there isn't already an existing environment variable with the name CMDCMDLINE. If there is, you'll get that CMDCMDLINE value instead.
%cmdextversion%: Expands into the string representation of the current value of cmdextversion. This assumes that there isn't already an existing environment variable with the name CMDEXTVERSION. If there is, you'll get that CMDEXTVERSION value instead.
You must use the else clause on the same line as the command after the if.
Examples
To display the message Cannot find data file if the file Product.dat cannot be found, type:
if not exist product.dat echo Cannot find data file
To format a disk in drive A and display an error message if an error occurs during the formatting process, type the following lines in a batch file:
:begin
@echo off
format a: /s
if not errorlevel 1 goto end
echo An error occurred during formatting.
:end
echo End of batch program.
To delete the file Product.dat from the current directory or display a message if Product.dat is not found, type the following lines in a batch file:
IF EXIST Product.dat (
del Product.dat
) ELSE (
echo The Product.dat file is missing.
)
Note
These lines can be combined into a single line as follows:
IF EXIST Product.dat (del Product.dat) ELSE (echo The Product.dat file is missing.)
To echo the value of the ERRORLEVEL environment variable after running a batch file, type the following lines in the batch file:
goto answer%errorlevel%
:answer1
echo The program returned error level 1
goto end
:answer0
echo The program returned error level 0
goto end
:end
echo Done!
To go to the okay label if the value of the ERRORLEVEL environment variable is less than or equal to 1, type:
if %errorlevel% LEQ 1 goto okay
404 - Page not found
We couldn't find this page. You can try signing in, or choosing from the relevant search results below:
We couldn't find this page. You can try changing directories, or choosing from the relevant search results below:
404 - Page not found
We couldn't find this page. You can try signing in, or choosing from the relevant search results below:
We couldn't find this page. You can try changing directories, or choosing from the relevant search results below:
inactive
Marks the system partition or boot partition with focus as inactive on basic master boot record (MBR) disks.
An active system or boot partition must be selected for this operation to succeed. Use the select partition command command to select the active partition and shift the focus to it.
Caution
Your computer might not start without an active partition. Don't mark a system or boot partition as inactive unless you are an experienced user with a thorough understanding of the Windows family of operating systems.If you're unable to start your computer after marking the system or boot partition as inactive, insert ...
After you mark the system partition or boot partition as inactive, your computer starts from the next option specified in the BIOS, such as the CD-ROM drive or a Pre-Boot eXecution Environment (PXE).
If you're unable to start your computer after marking the system or boot partition as inactive, insert the Windows Setup CD in the CD-ROM drive, restart the computer, and then repair the partition using the fixmbr and fixboot commands in the Recovery Console.
After you mark the system partition or boot partition as inactive, your computer starts from the next option specified in the BIOS, such as the CD-ROM drive or a Pre-Boot eXecution Environment (PXE).
Syntax
inactive
Examples
inactive
ipconfig
Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Used without parameters, ipconfig displays Internet Protocol version 4 (IPv4) and IPv6 addresses, subnet mask, and default gateway for all adapters.