Software⏱️ 4 min read📅 2026-06-19

How to Fix code 5 Error – error creating registry key: HKEY_CURRENT_USER\Software\Classes\.ts\OpenWithProgids. RegCreateKeyEx failed: code 5 Access denied

Error creating registry key: HKEY_CURRENT_USER\Software\Classes\.ts\OpenWithProgids. RegCreateKeyEx failed: code 5 Access denied.

Quick Answer: Run VSCode as administrator and try to associate the .ts file type with it again.

Error Creating Registry Key: HKEY_CURRENT_USER\ Software\ Classes\\.ts\\OpenWithProgids

RegCreateKeyEx failed: code 5 Access denied. When you open VSCode on Windows 10, a pop-up window message appears requiring an action.

This issue affects users who have installed VSCode and are experiencing difficulties with file associations. The error is frustrating as it prevents the user from using VSCode efficiently.

To resolve this issue, we will explore the root causes of the problem and provide two primary fix methods.

🔍 Why This Happens

  • The first main reason why this error happens in detail is that the .ts file type association is not properly configured in the registry. When you try to open a .ts file with VSCode, the system cannot find the associated program due to the missing registry key.
  • An alternative reason for this issue could be related to Windows 10's User Account Control (UAC) settings, which might be restricting access to the registry key.

🚀 How to Resolve This Issue

Method 1: Editing the Registry Key Manually

  1. Step 1: Open the Registry Editor by typing `regedit` in the Run dialog box and pressing Enter.
  2. Step 2: Navigate to HKEY_CURRENT_USER\Software\Classes\.ts in the Registry Editor.
  3. Step 3: Create a new key called OpenWithProgids and set its type to REG_SZ.
  4. Step 4: Double-click on the OpenWithProgids key and add the value `vscode` to it.
  5. Step 5: Close the Registry Editor and restart VSCode.
  6. Step 6: Method 1 should resolve the issue if you have successfully created the registry key.

Method 2: Using a Third-Party Tool

  1. Step 1: Download and install a third-party tool such as Regedit++ or Regedit4.
  2. Step 2: Launch the third-party tool and navigate to the HKEY_CURRENT_USER\Software\Classes\.ts key.
  3. Step 3: Use the tool's interface to create a new key called OpenWithProgids and set its type to REG_SZ.
  4. Step 4: Double-click on the OpenWithProgids key and add the value `vscode` to it.
  5. Step 5: Close the third-party tool and restart VSCode.
  6. Step 6: Method 2 can be an alternative solution if you are not comfortable editing the registry manually.

🎯 Final Words

In conclusion, resolving the error creating registry key: HKEY_CURRENT_USER\Software\Classes\.ts\OpenWithProgids RegCreateKeyEx failed: code 5 Access denied involves understanding the root cause of the issue and applying one of the two primary fix methods. By following these steps, you should be able to resolve the issue and use VSCode without any further pop-up windows.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions