When developing, right-clicking files or folders to open them in VSCode is a daily routine. However, sometimes the "Open with Code" menu option mysteriously disappears.
This article provides two proven solutions to restore this essential functionality. We'll start with the simplest reinstallation method, then cover manual registry configuration for stubborn cases.
Prerequisites
This guide targets Windows environments. Registry file configuration is Windows-specific, so macOS and Linux users will need alternative approaches.
Identifying the Problem
First, let's confirm that the "Open with Code" menu is actually missing.
Normally, when you right-click files or folders, you should see:
- For folders: "Open with Code"
- For files: "Open with Code"
If these menu options are missing, the following methods will restore them.
Solution 1: VSCode Reinstallation
The simplest and most reliable approach is reinstalling VSCode.
Steps
-
Visit VSCode Official Website
Navigate to the Visual Studio Code official website.
-
Download the Installer
Click the "Download for Windows" button to download the installer.
-
Run the Installation
Execute the downloaded installer and follow the installation wizard.
Important Notes:
- No need to uninstall existing VSCode
- If you see "Add to right-click menu" option during installation, ensure it's checked
-
Verify Functionality
After installation completes, right-click any file or folder to confirm the "Open with Code" menu appears.
This method resolves most cases, but if the menu still doesn't appear, try the manual configuration below.
Solution 2: Manual Registry File Configuration
When reinstallation doesn't work, we can directly edit Windows registry to add the right-click menu.
Step 1: Locate VSCode Executable Path
First, we need to find where VSCode's executable file (Code.exe) is located.
-
Launch VSCode
Start VSCode application.
-
Open Task Manager
Press
Ctrl + Shift + Esc
to open Task Manager. -
Find Code.exe Path
- Locate "Code.exe" in the process list
- Right-click and select "Open file location"
- When Explorer opens, copy the full path from the address bar
Example:
C:\Users\username\AppData\Local\Programs\Microsoft VS Code\Code.exe
Step 2: Create Registry File
Next, we'll create a registry configuration file.
-
Open Notepad
Open Windows Notepad.
-
Paste the Following Content
registryWindows Registry Editor Version 5.00 ; --- "Open with Code" menu for folder right-click --- ; Register right-click settings for folders [HKEY_CLASSES_ROOT\Directory\shell\VSCode] @="Open with Code" "Icon"="\"C:\\Users\\username\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0" [HKEY_CLASSES_ROOT\Directory\shell\VSCode\command] @="\"C:\\Users\\username\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%V\"" ; --- "Open with Code" menu for file right-click --- ; Register right-click settings for files [HKEY_CLASSES_ROOT\*\shell\VSCode] @="Open with Code" "Icon"="\"C:\\Users\\username\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0" [HKEY_CLASSES_ROOT\*\shell\VSCode\command] @="\"C:\\Users\\username\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\""
-
Replace the Path
Replace
username
with your actual Windows username.Example: If the path from Step 1 is
C:\Users\john\AppData\Local\Programs\Microsoft VS Code\Code.exe
, set it as:C:\\Users\\john\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe
-
Save the File
Save the file with a
.reg
extension, such as "vscode-menu.reg".
Step 3: Apply Registry Settings
-
Execute the Registry File
Double-click the created
.reg
file. -
Confirm in Dialog
When prompted "Do you want to add the information to the registry?", click "Yes".
-
Verify Completion
When you see "Information has been successfully entered into the registry", click "OK".
Step 4: Restart Explorer
To apply the registry changes, restart Windows Explorer.
- Open Task Manager (
Ctrl + Shift + Esc
) - Select "Windows Explorer"
- Click the "Restart" button
Step 5: Verify Functionality
After Explorer restarts, verify:
- Right-click any folder → "Open with Code" appears
- Right-click any file → "Open with Code" appears
Removing the Configuration
If you made a mistake or want to remove the right-click menu, use the following removal registry file.
Creating Removal Registry File
-
Open Notepad
Open a new Notepad window.
-
Paste the Following Content
registryWindows Registry Editor Version 5.00 ; --- Remove "Open with Code" menu for folders --- [-HKEY_CLASSES_ROOT\Directory\shell\VSCode] ; --- Remove "Open with Code" menu for files --- [-HKEY_CLASSES_ROOT\*\shell\VSCode]
-
Save the File
Save with a
.reg
extension, such as "vscode-menu-remove.reg". -
Execute Removal
Double-click the removal
.reg
file and confirm with "Yes" in the dialog. -
Restart Explorer
Restart Explorer using the method described earlier to remove the "Open with Code" menu.
Troubleshooting
Menu Not Appearing
- Verify the path is correctly configured
- Ensure username is properly replaced
- Confirm VSCode is correctly installed
Permission Errors
- Try running the registry file as administrator
- Check if antivirus software is blocking the operation
Configuration Mistakes
- Use the removal registry file to reset settings
- Then re-add with correct configuration
Summary
We've covered two methods to restore VSCode's missing right-click menu:
Solution 1: Reinstallation
- Simplest and most reliable
- Preserves existing settings
- Resolves most cases
Solution 2: Manual Configuration
- Effective when reinstallation fails
- Direct registry editing for guaranteed results
- Requires more steps but provides fundamental solution
This small feature significantly impacts development efficiency. When it disappears, it's genuinely inconvenient. I hope this article helps anyone facing the same issue.
Note: This article is based on information as of January 2025. Configuration methods may change due to VSCode version updates.
Related Articles
Complete Guide to Setting Up Docker + PostgreSQL Development Environment
Learn how to set up a PostgreSQL development environment using Docker and Docker Compose. From initial setup to schema creation, discover a practical configuration for real-world development.
GitHub Branch Protection Setup: Securing Your Main Branch with the New UI
Learn how to protect your main branch using GitHub's new UI interface. This guide covers step-by-step instructions for preventing direct pushes and enforcing pull request workflows.
Setting Up Local LLM Development Environment with Ollama and Cline on Windows
A comprehensive guide to setting up a local LLM development environment using Ollama and Cline on Windows with the gpt-oss:20b model, tested on a 32GB RAM PC.