My batch script uses the choice command. And in my script I would want to check if choice.exe exists because it is the application that has the choice command.
And I know exactly how to do that. By executing the choice command and making it so that if it fails, it exits the script
choice || goto:nochoiceapp
:nochoiceapp
echo Cannot continue with script
echo Your system doesn't have choice.exe
pause
But I want to do this at the start of my script. Not just when the choice command is needed.
And I want this to only check if choice.exe exists, not actually executing "choice". It would lead to a choice prompt
How do I make it so that it executes the choice command but does nothing?
Choice is a regular system executable that's located in System32. You can simply check that the file exists.
if not exist "%SystemRoot%\System32\choice.exe" goto :nochoiceapp