@Anak, thank you for your comment and the suggestion.
Actually, I modified my original script to the hard-coded version before posting, since I thought (maybe this was a mistake) this might prevent troubles with uncommon settings. In case it might be useful for somebody, my original script sets the the7zipexe this way:
Code:
REM --- get the path to 7zip.exe
cd "%~dp0"
for /f "delims=" %%i in ('_get_7zip.bat') do (SET the7zipexe=%%i)
IF "%the7zipexe%"=="no" (GOTO exenotfound)
And the _get_7zip.bat:
Code:
@ECHO OFF
REM ------- try to get a manually set 7-zip executable
SET theexe=C:\Program Files\7-Zip\7z.exe
IF EXIST "%theexe%" (GOTO foundit)
REM ------- try to get another manually set 7-zip executable
SET theexe=C:\7za920\7za.exe
IF EXIST "%theexe%" (GOTO foundit)
REM ------- repeat this for other non-standard locations on your machines
REM ------- try to get the installed 7-zip executable
FOR /f "tokens=2*" %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\Software\7-Zip" /v Path') DO SET theexe=%%B\7z.exe
IF EXIST "%theexe%" (GOTO foundit)
SET theexe=no
:foundit
ECHO %theexe%