Fix Visual Studio 2013 Start Menu shortcuts

Click here to see this bug on Connect.

Visual Studio 2013 configures Start Menu shortcuts differently to earlier versions. Specifically, it adds a shortcut to Visual Studio Tools (%PROGRAMFILES(X86)%\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts), where Visual Studio 2012 added a directory called Visual Studio Tools and added copies of the shortcuts. This is all a bit confusing, but the end result is that searching in the Start Menu/Screen won’t bring up results for useful things like the Developer Command Prompt or Spy++.

This annoyed me sufficiently that I wrote a PowerShell script (run it as administrator) to restore the shortcut directory:

$shortcutpath = "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2013\Visual Studio Tools.lnk"
$newshortcutdir = "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2013\Visual Studio Tools"
If (Test-Path $shortcutpath) {
  $shell = New-Object -COM WScript.Shell
  $toolsdir = $shell.CreateShortcut($shortcutpath).TargetPath
  # create directory if necessary
  If (-Not(Test-Path $newshortcutdir)) {
    mkdir $newshortcutdir
  }
  # copy shortcut files
  copy "$toolsdir\*.lnk" $newshortcutdir
  # hide old shortcut
  $shortcut = Get-Item $shortcutpath -Force
  $shortcut.Attributes = $shortcut.Attributes -bor [System.IO.FileAttributes]::Hidden
} else {
  "Shortcut not found."
}

The Visual Studio Shortcuts directory doesn’t contain shortcuts to Spy++ (and a number of other programs). Here’s another script to restore shortcuts to Spy++:

$shortcutdir = "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2013\Visual Studio Tools"
$toolsdir = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 12.0\Common7\Tools"
$shell = New-Object -COM WScript.Shell
$spyshortcut = $shell.CreateShortcut("$shortcutdir\Spy++.lnk")
$spyshortcut.TargetPath = "$toolsdirspyxx.exe"
$spyshortcut.Save();
$spyshortcut = $shell.CreateShortcut("$shortcutdir\Spy++ (64-bit).lnk")
$spyshortcut.TargetPath = "$toolsdirspyxx_amd64.exe"
$spyshortcut.Save();