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.
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 )
What's the best way to do this in Windows?