Reputation: 331
The following is a simple batch file that should concatenate twi variables, however, when I echo the concatenated variable, only the current directory shows up (i.e the value stored in %~dp0% and not %~dp0% and %pth%
cls
if %PROCESSOR_ARCHITECTURE%==AMD64 set arch=x64
(
set pth=sql\ww
set newpath=%~dp0%pth%
echo %newpath%
)
echo.
echo.
echo Done!
echo.
pause
goto :eof
Any help would be appreciated.
Upvotes: 0
Views: 924
Reputation: 57322
you need delayed expansion because of the brackets:
cls
setlocal enableDelayedExpansion
if %PROCESSOR_ARCHITECTURE%==AMD64 set arch=x64
(
set pth=sql\ww
set newpath=%~dp0!pth!
echo !newpath!
)
echo.
echo.
echo Done!
echo.
pause
goto :eof
Upvotes: 2