"if" - Run Command Conditionally
What is the "if" batch command for?
The "if" command is for running a command conditionally.
Below is the "if" command syntax:
if condition command1 [else command2]
When the "if" command is executed, the specified condition will be evaluated first. If the condition is true, "command1" will be executed. If the condition is false and the "else" clause is provided, "command2" will be executed.
Here is an example on how to use the "if" command:
IF EXIST filename (DEL filename) ELSE (ECHO filename missing)
Notice that the "(DEL filename)" child command is enclosed in parentheses to end it before the ELSE keyword. Without parentheses ELSE will be consided as another file to be deleted.
2017-12-05, 291👍, 0💬
How to edit Mozilla FireFox configuration file? Mozilla FireFox has a configuration file that contro...
Where to find tutorials on using Windows 8 Security? Here is a collection of tutorials on Windows 8 ...
Can I disable Windows service "Smart Card Helper" to speedup my computer? Windows service "Smart Car...
Is MUWebControl Class a program to control your childrens' surfing the web? What it is exactly?
What is HPQTOA~1.EXE or HPQToaster.exe - Process - HpqToaster Module? Process HPQTOA~1.EXE or HPQToa...