:Get possible locations where the script could be installed :------------------------------------------------------- for /f "delims=" %%a in (C:\WINDOWS\system32\locations.txt) do if exist %%a set workingPath=%%a set scriptPath="%workingPath%\backup\projectBackup.bat" pushd . cd /d %workingPath% cd .. for /f %%a in ('chdir') do set repoLatex=%%a popd :Run it with the appropriate argument :------------------------------------------------------- %scriptPath% repo %repoLatex%