Fix: Microsoft VBScript compilation error 800A0408: Invalid character

Fixing Microsoft VBScript compilation error 800A0408: Invalid character

When you run a newly authored VBScript code that you copied from an existing/working script, you may possibly receive the “Microsoft VBScript compilation error 800A0408: Invalid character” as shown below.

—————————

Windows Script Host

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

—————————
OK
—————————

Analysis: This error usually indicates that there is an invalid character in the script that VBScript compiler can’t understand. Thus it fails with the error.

Cause: Very common cause for this error would the File Encoding used by the IDE/Editor software that you used to author/copy this script.

Fix: You need to ensure that your VBScript is encoded in ANSI format for the VBScript compiler to successfully execute your script.

How to Apply the fix: For the newbie’s, they can use any of the latest text editors like Notepad++, Notepad2, etc,. where you have an option to change the File Encoding.  My recommendation and much simpler tool is Notepad2 which gives to this option as shown below:

image

Handling it in default Notepad:

image

8 thoughts on “Fix: Microsoft VBScript compilation error 800A0408: Invalid character

  1. THANKS MAN ..just to correct you …simple NOtepad also gives you option to save it as ANSI code.FILE_>SAVE AS.

    NEWAZ thanks a lot

  2. I still get the error even after going through every step multiple times on rugular notepade because I crashed notepad++. Any help? Here’s the entire VBScript coding @ECHO off
    :top
    START %SystemRoot%system32notepad.exe
    GOTO top

Leave a Reply

Your email address will not be published. Required fields are marked *