Add Sublime Text to the right-click menu
1. Reference materials
Add Sublime Text3 to the right-click menu
2. How to solve it?
Super unpleasant operation
Since I uninstalled Notepad++, I have been using VS Code as my default text editor, but the startup speed of VS Code is still too slow. I recently switched to Sublime Text
I found a free installation version of Sublime Text on the Internet. It is particularly troublesome to open text files with unrecognized suffixes.
The following is the operation process
-
Right-click the file and select [Open Method]
-
It is not yet in the [Open Method], you can only choose [Find other applications on this computer]
-
After going around, I finally found a way to open Sublime Text
Just imagine, if you need to do this every time, I vomit, I installed it. In fact, there is a solution. I saw on the blog that there is such a solution: execute the Bash command in the installation directory of Sublime Text
Solution
-
When I opened the installation directory of Sublime Text, I was so moved that I shed tears. There is such a user-friendly setting, and they just wrote it for me.
-
The code of the Bash command is as follows, mainly to add some configuration information to the registry
@ECHO OFF & PUSHD %~DP0 & TITLE >NUL 2>&1 REG.exe query "HKU\S-1-5-19" || ( ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs" ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs" "%TEMP%\Getadmin.vbs" DEL /f /q "%TEMP%\Getadmin.vbs" 2>NUL Exit /b ) SET /P ST=输入a添加右键菜单,输入d删除右键菜单: if /I "%ST%"=="a" goto Add if /I "%ST%"=="d" goto Remove :Add reg add "HKEY_CLASSES_ROOT\*\shell\Sublime Text" /t REG_SZ /v "" /d "用 &Sublime Text 打开" /f reg add "HKEY_CLASSES_ROOT\*\shell\Sublime Text" /t REG_EXPAND_SZ /v "Icon" /d "%~dp0sublime_text.exe" /f reg add "HKEY_CLASSES_ROOT\*\shell\Sublime Text\command" /t REG_SZ /v "" /d "%~dp0sublime_text.exe \"%%1\"" /f exit :Remove reg delete "HKEY_CLASSES_ROOT\*\shell\Sublime Text" /f exit
-
Double-click to execute the .bat file, enter a, and then press Enter
-
Kaisen