💻 Software
Determine if command is recognized in a batch file
Fresh5 days ago
Mar 15, 202646463 viewsConfidence Score1%
1%
Problem
I'm writing a bat script in which I invoke a program (such as javac). For simplicity, I want to check if the command exists before I run it. i.e. If the command exists in PATH. For example, What's the best way to do this in Windows?
Error Output
if (my_command.exe is a recognized command) then ( my_command.exe my_args ) else ( REM Output was probably "'my_command.exe' is not recognized as an internal or external command, operable program or batch file." REM Do not run my_command.exe )
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Determine if command is recognized in a batch file
Low Risk
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix