VBScript: Invalid Character 800A0408 compilation error in Line 1 Char 1

Problem

I am receiving the vbscript error “Invalid Character 800A0408 compilation error at Line 1 Char 1” while running a vbscript file which contains following code (this is just a sample code).

Option Explicit
Dim strUser
strUser = "Morgan"
WScript.Echo "Hello ! " & strUser 
Wscript.Quit

I have received below error:

Script: C:Test.vbs
Line: 1
Char: 1
Error: Invalid character
Code: 800A0408
Source: Microsoft VBScript compilation error

Fix/Solution

This issue was occurs due to the Encoding method UTF-8 which I used to save the .vbs file. We should use the Encoding method ANSI to save .vbs file. Follow the below steps to fix this issue:

    1. Open the vbscript file in Notepad
    2. Go to File and click “Save as”
    3. Under the file name, you will see a drop down menu for Encoding. Choose ANSI.
    4. Save the file.

VBScript Invalid Character 800A0408 compilation error at Line 1 Char 1
Advertisement

Leave a Comment