How to load the 64-bit Visual Studio Tools Command Prompt

64-bitvisual studio 2010windows 7

My development machine is running Windows 7 Ultimate x64. I installed Visual Studio 2010 Ultimate. When I open the Visual Studio Command Prompt (2010), I get the message

Setting environment for using Microsoft Visual Studio 2010 x86 tools.

I have also setup the PowerShell Community Extensions in my Windows PowerShell user profile. And I use the Invoke-BatchFile cmdlet to install the Visual Studio Tools into all my PowerShell sessions

$vcargs = ?: {$Pscx:Is64BitProcess} {'amd64'} {'x86'}
$vcvars = "${env:VS100COMNTOOLS}..\..\VC\vcvarsall.bat"
Invoke-BatchFile $vcvars $vcargs

My vcargs resolves to amd64. I looked in the vcvarsall.bat file for the location of the x64 batch file and got ~dp0bin\amd64\vcvars64.bat. That directory (and file) does not exist.

How do I get the vcvars64.bat file installed properly?

Best Answer

When running in the batch processor, %~dp0 expands to the path where the .bat file is executing. So in the default install for VS2010, that resolves to c:\program files\microsoft visual studio 10.0\vc\bin\amd64\vcvars64.bat. Which is indeed missing, that's a bug they don't seem to be interesting in fixing.

Use "x86_amd64" instead. You'll get the cross compiler, the same one that's used by the IDE.