In recent days, I began to reuse vscode as the default editor (Python, cpp). After setting it as the default to open the software, I found that the icon of the program file in the windows file manager has become the icon of vscode itself, which does not distinguish the file type, which is inconvenient.
Modification effect:
Manually modify the registry
Modify tutorial The file icons associated with VS code have become the default icons of VS code?
-
VSCode has its own icon library, which is installed here
./VSCode\resources\app\resources\win32
As shown in the figure:
-
I'm a portable version of VSCode. Maybe that's why I don't have the correct icon. According to the method in the tutorial, I can repair it through the registry. The steps are as follows:
Take re associating py files as an example, find the icon of Python files in advance, and then
-
Open the registry editor in HKEY_ CLASSES_ Create a new item under root and give a name you like, such as vscode The structure of Py is established as shown in the figure below:
-
VSCode. The default value of Py is filled with the description of the file type, corresponding to here:
-
Fill in the path of the icon in the default value of DefaultIcon, such as:
"E:\VSCode\VSCode\resources\app\resources\win32\python.ico"
-
The default value of command under open is to fill in the path of VS Code, and then add a space and "% 1" (double quotation marks are also required, note that they are in English), such as:
"E:\VSCode\VSCode\Code.exe" "%1"
-
The default value of command under edit can be filled in another editor you like. It can be called when you right-click edit on the file. Here, take Notepad as an example. The filled content is:
notepad.exe "%1"
-
Go to HKEY_CLASSES_ROOT\.py, expand to see the item OpenWithProgids (create a new one if you don't have one). In this item, create a new string value, and fill in vscode for the name Py, leave the value blank
-
Press F5 to refresh the registry, and then restart Windows Explorer in task manager
-
Then, right-click the attribute of any py file and click change in the opening method. In the pop-up window, there will be an item marked with the new Visual Studio Code, which is the vscode associated in the registry just now Py, select this item, and the icon will become the icon you specified in DefaultIcon.
-
function. reg file modification
If there are multiple types of files that need to be modified, you can use the program to modify the registry.
- Replace vscode Py is the corresponding language, such as vscode cpp
- There are risks in modifying the registry. You can back up the corresponding two entries in the registry first:
- [HKEY_CLASSES_ROOT\VSCode.py]
- [HKEY_CLASSES_ROOT\.py]
- If the effect after operation is inconsistent with the expectation, you can check the inconsistency with the manual steps above
- After I run, line 4 cannot be updated to the registry and needs to be written manually
Python
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\VSCode.py] @="Python source file" [HKEY_CLASSES_ROOT\VSCode.py\DefaultIcon] @="\"E:\\VSCode\\VSCode\\resources\\app\\resources\\win32\\python.ico\"" [HKEY_CLASSES_ROOT\VSCode.py\shell] [HKEY_CLASSES_ROOT\VSCode.py\shell\edit] [HKEY_CLASSES_ROOT\VSCode.py\shell\edit\command] @="notepad.exe \"%1\"" [HKEY_CLASSES_ROOT\VSCode.py\shell\open] [HKEY_CLASSES_ROOT\VSCode.py\shell\open\command] @="\"E:\\VSCode\\VSCode\\Code.exe\" \"%1\"" [HKEY_CLASSES_ROOT\.py] @="Python.File" "Content Type"="text/plain" [HKEY_CLASSES_ROOT\.py\OpenWithProgids] "VSCode.py"=""
C++
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\VSCode.cpp] @="C++ source file" [HKEY_CLASSES_ROOT\VSCode.cpp\DefaultIcon] @="\"E:\\VSCode\\VSCode\\resources\\app\\resources\\win32\\cpp.ico\"" [HKEY_CLASSES_ROOT\VSCode.cpp\shell] [HKEY_CLASSES_ROOT\VSCode.cpp\shell\edit] [HKEY_CLASSES_ROOT\VSCode.cpp\shell\edit\command] @="notepad.exe \"%1\"" [HKEY_CLASSES_ROOT\VSCode.cpp\shell\open] [HKEY_CLASSES_ROOT\VSCode.cpp\shell\open\command] @="\"E:\\VSCode\\VSCode\\Code.exe\" \"%1\"" [HKEY_CLASSES_ROOT\.cpp] @="C++.File" "Content Type"="text/plain" [HKEY_CLASSES_ROOT\.cpp\OpenWithProgids] "VSCode.cpp"=""
Java
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\VSCode.java] @="JAVA source file" [HKEY_CLASSES_ROOT\VSCode.java\DefaultIcon] @="\"E:\\VSCode\\VSCode\\resources\\app\\resources\\win32\\java.ico\"" [HKEY_CLASSES_ROOT\VSCode.java\shell] [HKEY_CLASSES_ROOT\VSCode.java\shell\edit] [HKEY_CLASSES_ROOT\VSCode.java\shell\edit\command] @="notepad.exe \"%1\"" [HKEY_CLASSES_ROOT\VSCode.java\shell\open] [HKEY_CLASSES_ROOT\VSCode.java\shell\open\command] @="\"E:\\VSCode\\VSCode\\Code.exe\" \"%1\"" [HKEY_CLASSES_ROOT\.java] @="Java.File" "Content Type"="text/plain" [HKEY_CLASSES_ROOT\.java\OpenWithProgids] "VSCode.java"=""