Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'else' is not recognized as an internal or external command, operable program or batch file

I try to use with "else" command but I get the foloowing error:

'else' is not recognized as an internal or external command, operable program or batch file.

My code is:

if "zz"=="TRUE" (         copy /a zz + /a ee=/a zz     )      else (         copy /a e + /a %TMP%=/a e     ) 

What the problem?

like image 255
zipi Avatar asked Sep 11 '12 08:09

zipi


People also ask

How do I fix not recognized as an internal or external command operable program or batch file?

You can resolve this issue in three ways: First, use the full path of the executable file to launch the program. Second, add the program path to Windows environment variables. Finally, move the files to the System32 folder.

What does it mean is not recognized as an internal or external command?

The “Python is not recognized as an internal or external command” error is encountered in the command prompt of Windows. The error is caused when Python's executable file is not found in an environment variable as a result of the Python command in the Windows command prompt.

What is operable program or batch file?

A batch file is a script file that stores commands to be executed in a serial order. It helps automate routine tasks without requiring user input or intervention. Some common applications of batch files include loading programs, running multiple processes or performing repetitive actions in a sequence in the system.

Why Java is not recognized as an internal or external command operable program or batch file?

Here are the three easiest ways to fix Java's “not recognized as an internal or external command” error: Install or reinstall Java and the JDK on your computer. Add Java's bin directory to the computer's PATH. Restart the command prompt, terminal window or PowerShell.


1 Answers

The else needs to be on the same "line" (a) as the if. Remove the new-line before the else like so:

if "zz"=="TRUE" (     copy /a zz + /a ee=/a zz ) else (     copy /a e + /a %TMP%=/a e ) 

Please also note that "zz"=="TRUE" will never evaluate to true - I suspect you meant "%zz%"=="TRUE"?


(a): This isn't always a good description, though it's what the Microsoft documents use. Same command may have been better, and putting ) and else on a different line breaks it into two commands.

like image 130
RB. Avatar answered Oct 01 '22 16:10

RB.