Sublime as default editor

前端 未结 11 2111
误落风尘
误落风尘 2021-01-29 18:05

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 he

11条回答
  •  我在风中等你
    2021-01-29 18:44

    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

提交回复
热议问题