Windows 8 - Powershell Here with VS 2012 Tools

 
9/7/2012
Windows
0 Comments

The PowerToy Open Command Window Here has been a very useful extension for Windows XP.
With Windows 7 and Windows 8 the PowerShell is a good replacement for cmd.exe. This post shows how you PowerShell could be added to the context menu and how Visual Studio Tools become available in PowerShell.

Scott Hanselman already blogged about integrating PowerShell into the context menu by using an inf file.

I created a reg file to achieve the same. If you only want to open the PowerShell from your context menu, just import the reg file included in the download and you are done.

If you want to the Visual Studio Tools to be available in PowerShell, the bat file 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat' has to be executed after launching PowerShell. This can be done by using a PowerShell Profile. You could use the following script to setup the profile:

Set-ExecutionPolicy remoteSigned

New-Item -path "C:\Users\$env:username\Documents\" -name "WindowsPowerShell" -itemType "directory"

$stream = [System.IO.StreamWriter] "C:\Users\$env:username\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
% {
  $stream.WriteLine("function Get-Batchfile(`$file)")
  $stream.WriteLine("{")
  $stream.WriteLine("  `$theCmd = `"```"`$file```" & set`"")
  $stream.WriteLine("  cmd /c `$theCmd | Foreach-Object {")
  $stream.WriteLine("    `$thePath, `$theValue = `$_.split('=')")
  $stream.WriteLine("    Set-Item -path env:`$thePath -value `$theValue")
  $stream.WriteLine("  }")
  $stream.WriteLine("}")
  $stream.WriteLine("")
  $stream.WriteLine("Get-Batchfile(`"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat`")")
}
$stream.close()

Register in Windows Terminal

{
  "guid": "{26b30263-74e9-4146-b80e-11632e86d42d}",
  "name": "VS2019 Dev Prompt",
  "commandline": "cmd.exe /k \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\Tools\\VsDevCmd.bat\"",
  "hidden": false,
  "startingDirectory": "C:\\Users\\daniel.palme\\Desktop\\Projekte",
  "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png"
},

Downloads

Feedly Feedly Tweet


Comments