Couple of things. You need to wrap paths in double quotes to eliminate possible whitespace. Also, because we set variables inside of a loop (codeblock), it is best we use delayedexpansion.
Lastly and most importantly, NEVER set a variable name which exists as a system environment variable. Here, path will break your actual path, and commands will no longer work, so instead create a non existing name like mypath.
@echo off
setlocal enabledelayedexpansion
if exist clientshutdown3.exe (
start clientshutdown3.exe
) else (
set /p "mypath=Enter path of pdf file: "
start "" "!mypath!\lor.pdf"
)
pause
You could also get away without delayedexpansion by moving the start section to outside of the codeblock.
@echo off
if exist clientshutdown3.exe (
start clientshutdown3.exe
) else (
set /p "mypath=Enter path of pdf file: "
)
if defined mypath start "" "%mypath%\lor.pdf"
pause