VScode right-click menu added to use VSCode to open files and folders [Windows]
introduce
Right-click a file or folder to open it directly with VSCode, which is very convenient. But if we did not check these two options when installing VSCode, then we will not be able to enjoy this convenient function, so what should we do?
At this point there are 2 ways to fix it:
-
Reinstall the software
Just check these 2 options during the installation process (we are definitely not willing, many configurations and plug-ins are used to it, and it is very troublesome to reinstall, even setting sync is inevitable, especially if the development environment of python or C/C++ is configured, so we do not recommend this) Install
check -
Modify the registry
The result after completion:
-
Right click to open the file
-
Right click to open folder
-
Right-click an empty space:
Modify the registry to add right-click to open file properties
Configuration: Right-click to open file
1, Win+R to open and run, enter regedit, open the registry, find the HKEY_CLASSES_ROOT*\shell branch, if there is no shell branch, right-click under *, select "New - Item", and create a shell branch.
2. Create a new "VisualCode" item under the shell, double-click "Default" in the right window, and enter "Open with VSCode" in the data. This is the text displayed on the right button, you can write whatever you want, just for easy viewing
3. Create a new Command item under "VisualCode", and enter the installation path of the program in the "Default" key value column of the right window, mine is: "D:\anzhuang\Microsoft VS Code\Code.exe" "%1". Among them, %1 represents the file parameter to be opened.
4, Configure thumbnails. Create a new expandable string value on the VisualCode item, name it Icon, double-click, and put "D:\anzhuang\Microsoft VS Code\Code.exe" into the data.
5, Close the registry and it will take effect.
Modify the registry to add right-click to open folder properties
Configuration: Right-click to open folder
1, Win+R to open and run, enter regedit, open the registry, find the HKEY_CLASSES_ROOT\Directory\shell branch
2, same as 2 above, the value in the data is "open folder with VSCode"
Steps 3, 4, and 5 are exactly the same, and will not be repeated.
Modify the registry to add right-click blank area properties
Configuration: Right-click the blank space of the folder, open the folder
Win+R to open the operation, enter regedit, open the registry, find HKEY_CLASSES_ROOT\Directory\Background\shell\branch
2, exactly the same as the above 2
3. Same as above, change %1 to %V, for example: "D:\anzhuang\Microsoft VS Code\Code.exe" "%V"
4, 5 same as above, exactly the same
Note here is "%V"
The final effect is as follows, right click on the blank space to see:
Pay attention to whether the installation path is correct, do not copy mine directly. Directly right-click the desktop shortcut of vscode, look at the properties, and quickly copy it to its path. As shown below
Get the installation path