Daniel Palme

Daniel Palme

.NET consultant from Germany.

Blog > Windows 8 - Powershell Here with VS 2012 Tools

Windows 8 - Powershell Here with VS 2012 Tools

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()

Downloads

Powershell Here with VS 2017 Community Edition.zip
Powershell Here with VS 2015.zip
Powershell Here with VS 2013.zip
Powershell Here with VS 2012.zip


Subscribe to RSS Feed

Tags: Windows
 

New comment

:

:

:

:

 

Comments

No comments available.