Adding Native Tools Command Prompt on VS2015 RC - visual-studio

Since I cannot locate Native Tools CMD under the Tools menu, I try to manually add it in External Tools. Few questions:
Regardless of what I choose for Command (ARM, x86 or x64 etc.), Command is always C:\Windows\System32\cmd.exe. Why the different CMDs end up having the same path to the native System32's CMD?
Referring to this answer, I should insert /k "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat" to the arguments - what is the /k and what is the bat for this argument? Why do I need to pass a path as an argument to the command prompt?
What is Initial Directory?

Why the different CMDs end up having the same path to the native System32's CMD?
The VS2015* CMDs are just cmd.exe with some environment variables already set up for you. so for example instead of typing "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe" to run InstallUtil.exe you will just type InstallUtil and it will work. if you didn't set up the environment variables you will get an error message saying that 'installutil' is not recognized as an internal or external command, operable program or batch file.
what is the /k and what is the bat for this argument? Why do I need to pass a path as an argument to the command prompt?
/k is a parameter for cmd.exe and what it does is run the commands specified by the string that follows (in this case it will execute what's inside "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat" and will carry out).
What is Initial Directory?
Initial directory is used to specify the working directory that your cmd.exe instance will start in
So in the end you'll have something like this for Visual Studio 2015:
The "arguments" for VS2015 is :
/k "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"

I took a look at my start menu and right clicked on Developer Command Prompt for VS2015. Copied target %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat""
MSBuild Command Prompt for VS2015
Copied target %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsMSBuildCmd.bat""
https://connect.microsoft.com/VisualStudio/feedback/details/747807/vs2012-x64-native-tools-command-prompt

Related

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

mklink fails from Visual Studio

I have next pre build event:
cmd /C mklink /D /J "$(ProjectDir)SomeDir" "$(ProjectDir)"
This is expanded in(copied from MSBuild output):
cmd /C mklink /D /J "C:\Dir-1\Dir-2\other-dirs-here\SomeDir" "C:\Dir-1\Dir-2\other-dirs-here\"
When running the build with this build event the symbolic link is not created, but when I copy exactly the expanded output of Visual Studio in command line the link is created.
Do you know why?
EDIT: I have administrator rights on the computer. Both Visual Studio and Command Prompt have "Administrator" on top
Found the problem - the previous command in the build event was:
$(ANDROID_HOME)/tools/android.bat update project my-project-settings
and for some weird reasons prevented all commands after it to run...

Execute batch file. How to call .bat file, visual studio command prompt and change directory in opened command prompt window

#echo off
echo copy masterDB file from one directory to another one
copy "C:\dir\dbfile" "C:\dir1\dbfile"
cd c:\lvsdir
call lvsrun.bat
timeout /t 180
start %comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
cd C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
MSTest /testcontainer: C:\testdir\test.dll
I want to do via a batch file to copy a db file from one directory to another one(which executes correct), then should start lvsrun.bat file, which should start lvs server,
and then to open visual studio command prompt in a new window, change directory in opened command prompt to test directory and run test file. Problem occurs when i call lvsrun.bat, and it stucks there. New vs command prompt can't be opened. And having problem with changing directory in opened vs command prompt and run test file. Code above doesn't really work
You've asked two questions here. You should split them up and ask them as two separate SO questions.
Q1. Why is my batch file never getting past call lvsrun.bat?
A1. Because call will not return until the batch file it is calling has exited. If you want to launch lvsrun.bat and continue execution immediately, use start.
copy "C:\dir\dbfile" "C:\dir1\dbfile"
cd c:\lvsdir
start "" "%comspec%" /k lvsrun.bat
Q2. Why doesn't the new command window I launch run my test file?
A2. Your batch file will only control its command window. If you launch another command window, that one is on its own, you can't "send" commands to it. But you could instead run the test in the current window rather than launching another:
:: Use "call" here to run vcvarsall.bat to set up the environment in this process
call "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
cd C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
MSTest /testcontainer: C:\testdir\test.dll
Or you could make a second batch file just for running the test. For example, let's call it runtest.bat, and give it those exact same lines:
call "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
cd C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
MSTest /testcontainer: C:\testdir\test.dll
which would then get called from your original batch file either synchronously:
call runtest.bat
or asynchronously:
start "" "%comspec%" /c runtest.bat

Creating batch file to open Visual Studio command prompt?

I have tried something like this but did not work:
#echo off
call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
mstest /testcontainer: mytest.dll
save as .bat file and when i double click it does nothing.
So, I am trying to open command prompt located in visual studio and execute.
Are you trying to change the directory to "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"?
Try this:
#echo off
CD "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
mstest /testcontainer: mytest.dll
PAUSE
Your batch file seems to be a little out of shape there. I'm no expert, but you have:
call "C:\Program Files\Microsoft Visual Studio 2008\VC\"
...but without a batch file name. See this for info.
If mstest is your batch file name then the call should be more like:
call "C:\Program Files\Microsoft Visual Studio 2008\VC\mstest.bat " <arguments>

Running a Windows Batch Script to Startup Multiple Files

I'm trying to replace the programs that run from my startup directory with a batch script. The batch script will simply warn me that the programs are going to run and I can either continue running the script or stop it.
Here's the script as I have written so far:
#echo off
echo You are about to run startup programs!
pause
::load outlook
cmd /k "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE" /recycle
::load Visual Studio 2008
call "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
Both of these commands will load the first program and wait until I close it to load the second. I want the script to load the processes simultaneously. How do I accomplish this?
Edit: When I use the start command it opens up a new shell with the string that I typed in as the title. The edited script looks like this:
start "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE"
::load Visual Studio 2008
start "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
This works:
#echo off
echo You are about to run startup programs!
pause
::load outlook
start /b "" "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE" /recycle
::load Visual Studio 2008
start /b "" "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
Use START like this:
START "" "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE"
When your path is enclosed in quotes, START interprets it as the title for the window. Adding the "" makes it see your path as the program to run.
There is the start command that will behave much like if you clicked the files in Explorer.

Resources