TechBuzzPro

Fix Run VBS Error on Windows 10 – Step‑by‑Step Guide

· 5 min read · Windows & PC

In this article
  1. What You'll Need
  2. Step‑by‑Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can fix the “Run VBS” error on Windows 10 by re‑enabling Windows Script Host, correcting the .vbs file association, and ensuring the script has proper permissions.

What You'll Need

  • Administrator access to the computer
  • A basic text editor (Notepad or similar)
  • Command Prompt (run as administrator)
  • Optional: Registry Editor (regedit)

Step‑by‑Step

  1. Confirm the error. Double‑click any .vbs file. If Windows shows a message such as “Windows cannot open this file” or “Run VBS error”, note the exact wording – it usually means the script host is disabled or the file association is broken.
  2. Check whether Windows Script Host is disabled. Open Win + R, type regedit and press Enter. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings. If the Enabled DWORD exists and is set to 0, double‑click it and change the value to 1. Close the Registry Editor and restart the computer.
  3. If the registry key is missing, create it. Right‑click the Settings folder, choose New > DWORD (32‑bit) Value, name it Enabled, and set the value to 1. Restart.
  4. Use Group Policy (Windows 10 Pro or Enterprise). Press Win + R, type gpedit.msc and press Enter. Browse to Computer Configuration → Administrative Templates → Windows Components → Windows Script Host. Double‑click Enable Windows Script Host and set it to Enabled. Click OK and run gpupdate /force from an elevated command prompt.
  5. Repair the .vbs file association. Open an elevated Command Prompt (right‑click Start, choose Windows Terminal (Admin) or Command Prompt (Admin)). Run the following two commands one after the other:
    assoc .vbs=VBSFile
    ftype VBSFile="%SystemRoot%\System32\WScript.exe" "%1" %*
    These commands tell Windows that .vbs files belong to the VBSFile type and that the type should be opened with WScript.exe.
  6. Verify the default app for .vbs files. Open Settings > Apps > Default apps > Choose default apps by file type. Scroll to .vbs and ensure the default is Windows Script Host. If it shows something else, click the entry and select Windows Script Host.
  7. Check file permissions. Right‑click the problematic .vbs file, choose Properties > Security. Ensure your user account (or the Administrators group) has Read & Execute permission. If not, click Edit, check the box, and apply.
  8. Run a system file check. Corrupted system files can also prevent the script host from launching. In the elevated Command Prompt, type sfc /scannow and press Enter. Wait for the scan to finish and follow any on‑screen instructions.
  9. Test the script again. Double‑click the .vbs file. If the script runs (or at least the Windows Script Host dialog appears), the issue is resolved.
  10. Optional: Re‑install Windows Script Host via optional features. Open Settings > Apps > Optional features > Add a feature. Look for “Windows Script Host” (if listed) and install it. This step is rarely needed but can help on heavily modified systems.

Common Mistakes

  • Changing the Enabled value to 0 instead of 1. This re‑disables the host and reproduces the error.
  • Editing the wrong registry hive. The key must be under HKEY_LOCAL_MACHINE, not HKEY_CURRENT_USER, for system‑wide effect.
  • Running the assoc or ftype commands without administrator rights. Without elevation the commands silently fail.
  • Forgetting to restart after changing registry or Group Policy settings. The changes are not applied until the next logon or a manual restart.
  • Leaving antivirus software to block WScript.exe. Some security suites quarantine the executable, causing the same error.

Tips

  • Create a backup of the Settings registry key before editing. Right‑click the key, choose Export, and save the .reg file.
  • If you manage many computers, deploy the registry change via a .reg file or PowerShell script to keep the process consistent.
  • Use where wscript.exe in Command Prompt to confirm the executable exists in %SystemRoot%\System32.
  • When testing, use a simple script such as MsgBox "Hello" saved as test.vbs. This isolates the host from script‑specific errors.
  • If you suspect a third‑party program is interfering, perform a clean boot (disable non‑Microsoft services) and retry the script.

Troubleshooting

If the steps above do not resolve the issue, follow this escalation path:

  1. Confirm WScript.exe is present. Open C:\Windows\System32 and verify WScript.exe and Cscript.exe exist. If either file is missing or corrupted, copy them from a known‑good Windows 10 installation or run sfc /scannow again.
  2. Check for software conflicts. Temporarily disable any third‑party security suites, script‑blocking extensions, or system‑optimisation tools. Restart and test the script.
  3. Run a DISM repair. In an elevated Command Prompt, execute:
    DISM /Online /Cleanup‑Image /RestoreHealth
    After DISM finishes, run sfc /scannow once more.
  4. Inspect the Event Viewer. Press Win + X, choose Event Viewer. Look under Windows Logs > Application for errors with source “Windows Script Host” or “WScript”. The details often point to missing DLLs or permission problems.
  5. Create a new user profile. Corrupted user profiles can inherit broken file‑type associations. Create a local administrator account, log in, and test a .vbs file.
  6. Perform an in‑place upgrade. If none of the above works, download the latest Windows 10 ISO from Microsoft, run the setup, and choose “Keep personal files and apps”. This refreshes system components without a full clean install.

Frequently Asked Questions

Why does double‑clicking a .vbs file show “Windows cannot open this file”?

The most common cause is that Windows Script Host has been disabled via the registry or Group Policy, breaking the default handler for .vbs files.

Can I run a .vbs script from PowerShell instead of double‑clicking?

Yes. Open PowerShell as administrator and type cscript "C:\Path\YourScript.vbs". This bypasses file‑type association but still requires the script host to be enabled.

Is it safe to enable Windows Script Host on a corporate PC?

Enabling the host restores normal functionality, but administrators should ensure that only trusted scripts are executed and that endpoint protection is configured to scan .vbs files.

What does the registry value Enabled = 0 actually do?

It tells Windows to refuse launching any Windows Script Host process, effectively disabling both WScript.exe and Cscript.exe for all users.

Will resetting file associations affect other file types?

No. The assoc .vbs=VBSFile command only changes the association for the .vbs extension. Other file types remain untouched.

My antivirus still blocks .vbs files after I fix the host. What now?

Add an exclusion for WScript.exe and the folder containing your scripts, or consult the security software’s documentation for allowing script execution.