How do I find full path to an application in a batch script

前端 未结 6 784
礼貌的吻别
礼貌的吻别 2021-02-19 00:25

How do I in a batch script find the full path to application XYZ if it is installed

Clarifications:

  1. The application is not in the PATH
  2. All I h
6条回答
  •  情话喂你
    2021-02-19 01:01

    Sometimes this simple solution works, where you check to see if the output matches what you expect. The first line runs the command and grabs the last line of standard output.

    FOR /F "tokens=*" %%i in (' "xcopy /? 2> nul" ') do SET xcopyoutput=%%i
    if "%xcopyoutput%"=="" echo xcopy not in path.
    

提交回复
热议问题