Setting and using an environment variable in the same command
I am using Windows 7 and I want to set up an environment variable and use it in the same command. Specifically, I want to execute the following 2 commands simultaneously as a single command-:
set MYPATH="C:\Program Files (x86)\Microsoft Visual Studio 11.0" %MYPATH%\VC\vcvarsall.bat
In other words, I want the Windows version of this. This is what I've tried so far -:
set MYPATH="C:\Program Files (x86)\Microsoft Visual Studio 11.0" && cmd.exe /C "%MYPATH%\VC\vcvarsall.bat"
But it isn't working. So, Is there any way of doing this in Windows ?
This can be done by writing -:
cmd.exe /X /V:ON /C "set MYPATH="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\varsall.bat" && !MYPATH!"