Saturday 20 January 2018

windows - Determine if command is recognized in a batch file

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,


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?

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...