How can I change the default program for a file without changing its icon? For example, I'd like some file extensions (.css, .js, .cshtml, etc.) to be opened with Sublime Text, but I want to keep the original icon that MS Visual Studio has set.

marked as duplicate by user477799, Run5k, Pimp Juice IT, music2myear, Twisty Impersonator Apr 7 '17 at 18:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I'm not sure the proposed duplicate actually covers this question, at least the single answer that satisfied that OP. 1) That answer describes changing the default icon. This question seems to be asking about finer granularity. 2) Not changing the icon is different from setting a desired icon. Not changing it means you don't need to find or extract the icon you want to keep. – fixer1234 Apr 6 '17 at 21:07
  • 1
    To Windows it's pretty much the same thing unless you're going to muck about deep in the registry. The icon is tied to the filetype, not the extension itself (in registry icons are found in txtfile, not .txt). – music2myear Apr 7 '17 at 16:08

I have created this .reg file with some effort. It will change default program for these extensions: .js, .cs, .ascx, .aspx, .config and sets their icons to default icons for VS 2013:

Windows Registry Editor Version 5.00

@="ASP.NET User Control"

@="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Packages\\htmled.dll,1"



@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""



@="ASP.NET Server Page"

@="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Packages\\htmled.dll,4"



@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""



@="Visual C# Source file"

@="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC#\\VCSPackages\\csproj.dll,1"

@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""



@="JavaScript File"

@="\"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\msenvico.dll\",-223"

@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""



@="XML Configuration File"

@="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\Xml\\Microsoft.XmlEditorNeutralUI.dll,3"

@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""



@="ASP.NET Web Page (CSHTML)"

@="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Packages\\htmled.dll,9"

@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""



just copy it in a text file and save it as OpenWithSublimeText.reg and double click on it.

  • Could this script be adapted to work for other default programs and file extensions? – Steven M. Vascellaro Mar 5 '17 at 22:06

As answered by SSAURABHH on a similar question...

Default Programs Editor can do what you need:

Default Programs Editor makes it easy to fix file association settings in Windows, including context menu items, icons, and descriptions.


Not the answer you're looking for? Browse other questions tagged or ask your own question.