Icon for repairing VSCode associated files - Python, C++,Java

Posted by Seol on Fri, 18 Feb 2022 02:40:04 +0100

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


    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:

    • 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:
  • 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


Windows Registry Editor Version 5.00

@="Python source file"




@="notepad.exe \"%1\""


@="\"E:\\VSCode\\VSCode\\Code.exe\" \"%1\""

"Content Type"="text/plain"



Windows Registry Editor Version 5.00

@="C++ source file"




@="notepad.exe \"%1\""


@="\"E:\\VSCode\\VSCode\\Code.exe\" \"%1\""

"Content Type"="text/plain"



Windows Registry Editor Version 5.00

@="JAVA source file"




@="notepad.exe \"%1\""


@="\"E:\\VSCode\\VSCode\\Code.exe\" \"%1\""

"Content Type"="text/plain"


Topics: Python C++