Is there a way to set Sublime Text as the default text editor for file formats on Windows 7?
Also, if anyone knew a Sublime Text Tutorial or Wiki that would be really helpful.
Is there a way to set Sublime Text as the default text editor for file formats on Windows 7?
Also, if anyone knew a Sublime Text Tutorial or Wiki that would be really helpful.
Actually it is not my answer, I have just googled it:
HKEY_CLASSES_ROOT\Applications\sublime_text.exe\shell\open\command
For me that value pointed to the Desktop where portable version previously was placed. Thus it just didn't work.
P.S. And for me the reboot or logout were not necessary (WinXP).
"C:\Program Files\Sublime Text 2\sublime_text.exe" %1
–
Starlight Win
+ R
, because the run window is not opening. –
Enrapture "C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"
- that is with double-quotes around %1. I removed these double-quotes, so the value was "C:\Program Files\Sublime Text 3\sublime_text.exe" %1
, restarted explorer.exe and Sublime, and then it worked –
Lam Edit on Nov 21, 2014
Tim Lewis pointed out in the comment that there is a more generic version at http://www.binaryfortress.com/NotepadReplacer/, which works better.
Original Answer
Try this: https://github.com/grumpydev/Sublime-Notepad-Replacement
Here are some ways to associate Sublime Text Portable. The following text needs to be saved as a file with a .reg extension and then on that file Right Click > Merge.
This will add a Sublime right click menu entry to all files:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell]
@="Sublime"
[HKEY_CLASSES_ROOT\*\shell\Sublime]
@="&Sublime"
[HKEY_CLASSES_ROOT\*\shell\Sublime\command]
@="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\" \"%1\""
This will have Sublime Text replace all calls to notepad.exe:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Notepad.exe]
"Debugger"="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\" -z"
This will create a SublimeFile class which you can then associate with any extension.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SublimeFile\shell]
@="edit"
[HKEY_CLASSES_ROOT\SublimeFile\DefaultIcon]
@="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\SublimeFile\shell\edit\command]
@="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\" \"%1\""
This will then associate the .ext extension with SublimeFile:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.ext]
@="SublimeFile"
notepad.exe %1
and replace all found instances with notepad.exe "%1"
–
Dan [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Notepad.exe] "Debugger"="\"C:\Program Files\Sublime Text 3\sublime_text.exe\" -z"
–
Catapult 1: You can also set your associations in Control Panel:
Control Panel > Default Programs > Associate a file or protocol with a specific program:
2: Or, call it from code via IApplicationAssociationRegistrationUI::LaunchAdvancedAssociationUI
;)
HRESULT LaunchAdvancedAssociationUI(
[in] LPCWSTR pszAppRegName
);
You can just run CCleaner's registry cleaner tool and then choose and add the default program as usual. It worked for me when upgrading from ST2 to ST3.
Open context menu on file with desired extension in Explorer, than select Open with->You editor ( may be you need to browse for its binary before it appears in the list of available programs ) and set checkbox "Always use the selected program to open this kind of file".
I tried all options to make sublime text 3 as the default program for my .php, .css and/or .js files I don't exactly know why it all failed, I think it is related to windows 10 current version bug
But the good news is there is some working way for me, also for those who love CMD
FTYPE sublime="C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"
ASSOC .php=sublime
for js use this: ASSOC .js=sublime
and so on...Try this,
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
pause
I tested this for SublimeText 3(Portable) also and working fine. Create a .bat file with the above code and run it as administrator.
Reference : https://gist.github.com/mrchief/5628677
sublime can be set as the default text editor by following these steps:
I was facing the same problem. the only solution was correct it manually --> open regedit and navigate to Computer\HKEY_CLASSES_ROOT\Applications\, find the sublime_text.exe entry, and delete it. You should now be able to set Sublime Text 3 as the default editor for anything you want.
i found this solution in this post:https://forum.sublimetext.com/t/cant-make-default-editor-in-windows/10747/14
If you are using the portable version, you can't set Sublime as the default program for any files because Windows won't acknowledge it as a program that can open things.
© 2022 - 2024 — McMap. All rights reserved.