Overview
The Visual Studio Developer Command Prompt is a command window that loads up a bunch of useful environmental enhancements when it starts. This let's you access things like sn.exe from your command window. However, it loads up in cmd.exe and I prefer using PowerShell 'cos it's proper useful! This article shows one way making PowerShell act like the Developer Command Prompt.
Adjust your PowerShell Profile
When PowerShell loads it looks for a profile file under your user profile and loads that if found. By default, the profile file is:
\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Note that you can access your documents folder path from PowerShell like so:
$([environment]::getfolderpath("mydocuments")
If that file isn't there, create it, add the following code and save it:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-Environment { | |
# Source: http://stackoverflow.com/a/4385011/2608 | |
# and https://github.com/nightroman/PowerShelf/blob/master/Invoke-Environment.ps1 | |
param | |
( | |
[Parameter(Mandatory=1)][string]$Command, | |
[switch]$Output, | |
[switch]$Force | |
) | |
$stream = if ($Output) { ($temp = [IO.Path]::GetTempFileName()) } else { 'nul' } | |
$operator = if ($Force) {'&'} else {'&&'} | |
foreach($_ in cmd /c " $Command > `"$stream`" 2>&1 $operator SET") { | |
if ($_ -match '^([^=]+)=(.*)') { | |
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2]) | |
} | |
} | |
if ($Output) { | |
Get-Content -LiteralPath $temp | |
Remove-Item -LiteralPath $temp | |
} | |
} | |
# Configures the environment as per the VS Developer Command Prompt. | |
function As-VSPrompt { | |
# VS 2013 | |
Invoke-Environment '"%VS120COMNTOOLS%\vsvars32.bat"' | |
} |
Adjust the environment in the last line above according to your VS installation.
Load in PowerShell
Open up a new PowerShell window (existing windows will not have loaded the profile we've just saved). Type sn and to show that you don't have access to sn.exe:

Then type As-VSPrompt and hit . This will load up the Developer Command Prompt profile. Type sn and again and you see sn.exe reporting for duty:
