If it is a cmd line program that you can run to get a help screen etc, then this is one option: it will add the folder to the path if the file can't be found.
name.exe /? >nul 2>&1
if %errorlevel% equ 9009 set path=%path%;c:\files\bin
Pregunta
Given a PATH of C:\local\bin;C:\Program Files (x86)\foo\bin;
How do I escape or otherwise handle the embedded (x86)
when using parameter expansion?
Here's what I have now (ultimate aim is to extend the path to a known location if the specified .exe's are not currently in PATH):
for %%g in (touch.exe rsync.exe) do (
if "%%~dp$PATH:g" =="" set PATH=%PATH%;%~dp0\bin
)
and the current result (and with PATH being unchanged of course):
\foo\bin\ was unexpected at this time
Solución
If it is a cmd line program that you can run to get a help screen etc, then this is one option: it will add the folder to the path if the file can't be found.
name.exe /? >nul 2>&1
if %errorlevel% equ 9009 set path=%path%;c:\files\bin