How to test if an executable exists in the %PATH% from a windows batch file?

后端 未结 9 609
暖寄归人
暖寄归人 2020-12-22 20:33

I\'m looking for a simple way to test if an executable exists in the PATH environment variable from a Windows batch file.

Usage of external tools not provided by th

9条回答
  •  执念已碎
    2020-12-22 21:01

    If you are searching something like me on startup folder, should go folder. For example i search exe on startup folder and i use this code like

    @echo off
    cd C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
    where /q program.exe
    IF ERRORLEVEL 1 (
    echo F | xcopy /Y /S /I /E "\\programsetup\programsetup.exe" 
    "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\program.exe"
    ) ELSE (
    ECHO Application exists. Let's go!
    )
    

提交回复
热议问题