Update 2018-08-19: I improved the script to manage the entire icon replacement, and am handling the recent change to VS Code using a user-profile-based install.

Update 2018-09-08: The script now prompts for whether to create the desktop icon. In most cases, after the first run, you won't need to. It also refreshes the icon cache, so you should see the change immediately.

I never understood why so many developers--people who generally have no visual design sense--decided that the orange Visual Studio Code icon was where they would take their stand.

I liked the orange, for a few reasons:

  1. It stood out from my purple Visual Studio icon.
  2. It was bold.
  3. I don't have some childhood trauma related to orange.

On Windows, it's not practical to change the icon completely back to orange. That would require modifying the code.exe file. But you can get most of the way there. The steps below will change the icon for:

  1. Right-click folder/file > Open with VS Code
  2. Right-click pinned shortcut > Visual Studio Code
  3. Shortcut

It won't change the icon in the VS Code editor, or in context menu Right-click pinned shortcut > New Window

Here's a 7z file with the orange icons and Powershell script.

vs-code-orange.7z

Find your VS Code Image Path

As of August 2018, VS Code recommends a user setup, which writes the app to the user's profile. Before that, the app was written to Program Files. The Powershell script determines the correct location.

User Profile Path
%LOCALAPPDATA%\Programs\Microsoft VS Code\resources\app\resources\win32\

Program Files Path
%ProgramFiles%\Microsoft VS Code\resources\app\resources\win32\

Replace the VS Code icons

There are three icons in the Image Path. Backup and replace all three with the same sizes and names. For changing the .png files, Paint.Net will work. For the .ico file, I like Greenfish Icon Editor Pro.

Update the Registry

There are four registry keys that point to Code.exe for the icon. Change these to [ImagePath]]\code_file.ico.

HKEY_CLASSES_ROOT*\shell\VSCode\Icon" HKEY_CLASSES_ROOT\Directory\Background\shell\VSCode\Icon HKEY_CLASSES_ROOT\Drive\shell\VSCode\Icon HKEY_CLASSES_ROOT\Software\Classes\Directory\shell\VSCode\Icone

Use a Shortcut to Open VS Code

  1. Right-click in a folder, choose New > Shortcut
  2. Item location: "%LOCALAPPDATA%\Programs\Microsoft VS Code\code.exe" or "%ProgramFiles%\Microsoft VS Code\Code.exe"
  3. Name: "VS Code"
  4. Right-click the shortcut, click Change Icon.
  5. Select [ImagePath]\code_file.ico

You can now drag this icon into the task bar to pin it.

Powershell Script

Here's a Powershell script that does everything. Be sure the image files are in the script folder.

# This is the new "standard" path
$basePath = "$env:LOCALAPPDATA\Programs\Microsoft VS Code\resources\app\resources\win32\"

If (-Not (Test-Path $basePath))
{
    # This is the old path
    $basePath = "$env:ProgramFiles\Microsoft VS Code\resources\app\resources\win32\"
}

Write-Output "VS Code Path: $basePath"


Write-Output "Copying orange icons"
$iconFile = Join-Path $basePath  "code_file.ico"

Copy-Item -Path @(Join-Path $PSScriptRoot *) -Include *.png,*.ico -Destination $basePath

Write-Output "Setting Registry..."
New-PSDrive -PSProvider registry -Root HKEY_CLASSES_ROOT -Name HKCR
Set-ItemProperty -LiteralPath "HKCR:\*\shell\VSCode" -Name Icon -Value $iconFile
Set-ItemProperty -Path HKCR:\Directory\Background\shell\VSCode -Name Icon -Value $iconFile
Set-ItemProperty -Path HKCR:\Drive\shell\VSCode -Name Icon -Value $iconFile
Set-ItemProperty -Path HKCU:\Software\Classes\Directory\shell\VSCode -Name Icon -Value $iconFile
Remove-PSDrive -Name HKCR 

$shortcut = Read-Host "Create a shortcut?"
if ($shortcut -eq 'y')
{
    Write-Output "Creating shortcut in Desktop"
    $TargetFile = $basePath + "..\..\..\..\code.exe"
    $ShortcutFile = "$env:UserProfile\Desktop\VS Code.lnk"
    $WScriptShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
    $Shortcut.TargetPath = $TargetFile
    $Shortcut.IconLocation = $iconFile
    $Shortcut.Save()
}

# refresh icon cache
Update-ExplorerIcon

Write-Output "Finished."
Pause




# http://community.idera.com/powershell/powertips/b/tips/posts/refreshing-icon-cache
function Update-ExplorerIcon {
  [CmdletBinding()]
  param()

  $code = @'
private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff); 
private const int WM_SETTINGCHANGE = 0x1a; 
private const int SMTO_ABORTIFHUNG = 0x0002; 
 

[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)]
 static extern bool SendNotifyMessage(IntPtr hWnd, uint Msg, UIntPtr wParam,
   IntPtr lParam);

[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)] 
  private static extern IntPtr SendMessageTimeout ( IntPtr hWnd, int Msg, IntPtr wParam, string lParam, uint fuFlags, uint uTimeout, IntPtr lpdwResult ); 
 
 
[System.Runtime.InteropServices.DllImport("Shell32.dll")] 
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);


public static void Refresh()  {
    SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero);
    SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, IntPtr.Zero, null, SMTO_ABORTIFHUNG, 100, IntPtr.Zero); 
}
'@

  Add-Type -MemberDefinition $code -Namespace MyWinAPI -Name Explorer 
  [MyWinAPI.Explorer]::Refresh()

}