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 ?

Answers


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!"  

Source


Need Your Help

How can I pass a variable from one form to the next in Django 1.6

django django-models django-forms django-views

I am trying to assign the user value in my views.py from another form but I always seem to get the following error. Cannot assign "u'applematter'": "Student.user" must be a "User" instance.

ctypedef in Cython with numpy: what is right convention?

python c numpy cython

In Cython when using numpy, what is the point of writing:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.