Showing posts with label Windows Tips. Show all posts
Showing posts with label Windows Tips. Show all posts

Tuesday, 8 April 2025

How to add a right-click context menu option in Windows Explorer

 To add a right-click context menu option in Windows Explorer that opens the current folder in Command Prompt and automatically runs code . (to open it in VS Code), you can do this by editing the Windows Registry.

๐Ÿš€ What This Will Do

When you right-click on a folder (or inside a folder and right-click empty space), you'll see an option like "Open with VS Code (code .)", which:

  1. Opens a Command Prompt in that folder.

  2. Runs code . automatically.

๐Ÿ› ️ Steps to Add the Context Menu Option

✅ Step 1: Open Registry Editor

        Press Win + R, type regedit, and press Enter.

✅ Step 2: Navigate to the Context Menu Key

Go to:

Computer\HKEY_CLASSES_ROOT\Directory\Background\shell

Tip: This location adds the context menu item when you right-click inside a folder (not on a folder).

✅ Step 3: Create a New Key

  1. Right-click on shell → New → Key → name it:

    Open VSCode Here
  2. Select this new key and in the right pane, double-click on (Default) and set the value to:

    Open with VS Code (code .)

✅ Step 4: Add the Command

  1. Right-click on the Open VSCode Here key → New → Key → name it:

    command
  2. Select the command key, and in the right pane, se

    t the (Default) value to:

    cmd.exe /k "code ."

๐Ÿงช Test It

  • Right-click inside any folder in Windows Explorer.

  • You should see: "Open with VS Code (code .)"

  • Clicking it opens Command Prompt and runs code .

How to add a right-click context menu option in Windows Explorer

 To add a right-click context menu option in Windows Explorer that opens the current folder in Command Prompt and automatically runs code ...