Invalid Character Error In Vbscript
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn microsoft vbscript compilation error 800a0400 more about Stack Overflow the company Business Learn more about hiring developers or vbscript compilation error syntax error posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community microsoft vbscript compilation error: expected statement Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why does VBScript say “Invalid Character” when using ExecuteGlobal to
Microsoft Vbscript Compilation Error '800a03ea'
import a .vbs function library file? up vote 2 down vote favorite 2 I am encountering a "Invalid Character" error in my VBscript! In particular, within this block of code: '******************************************************************* 'Import Code 'by Cheyne Wallace 'November 2008 'When using only VBscript (not QTP), this code will import any function library passed into it. 'Copy this function into a file, then use it to bring in various other microsoft vbscript compilation error '800a0401' function libraries. 'Usage: ' Import "Library.vbs" Sub Import(strFile) Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject") Dim wss : Set wss = CreateObject("WScript.Shell") strFile = wss.ExpandEnvironmentStrings(strFile) strFile = objFSO.GetAbsolutePathName(strFile) Set objFile = objFSO.OpenTextFile(strFile, 1) ExecuteGlobal objFile.ReadAll objFile.Close : Set objFSO = nothing Set wss = Nothing End Sub The error states "Microsoft VBScript compilation error. Invalid Character. Code: 800A0408" on Char: 2, Line 206 which is the very first letter on ExecuteGlobal objFile.ReadAll (character 1 is a tab). I have typed and retyped the line, as well as the surrounding line breaks. Still, it keeps saying 'Invalid character'. What is going on?? character-encoding vbscript import importerror invalid-characters share|improve this question edited Aug 22 '13 at 0:25 asked Dec 21 '12 at 19:56 Eptin 56931131 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted As it turns out, the problem was not with ExecuteGlobal, but instead with the .vbs file I was attempting to import. The file I was importing was not in ANSI encoding. If VBScript has a problem with the file you are importing, it will report the error at the character and line for the beginning of ExecuteGlobal (which admittedly causes confusion). Open the fil
here for a quick overview of the site Help Center Detailed answers vbscript compilation error expected end of statement to any questions you might have Meta Discuss the workings
How To Run Vbscript
and policies of this site About Us Learn more about Stack Overflow the company Business
Notepad Tricks
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack http://stackoverflow.com/questions/13996394/why-does-vbscript-say-invalid-character-when-using-executeglobal-to-import-a Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why does VBScript say “Invalid Character” when using ExecuteGlobal to import a .vbs function library file? up vote 2 down vote favorite 2 I am http://stackoverflow.com/questions/13996394/why-does-vbscript-say-invalid-character-when-using-executeglobal-to-import-a encountering a "Invalid Character" error in my VBscript! In particular, within this block of code: '******************************************************************* 'Import Code 'by Cheyne Wallace 'November 2008 'When using only VBscript (not QTP), this code will import any function library passed into it. 'Copy this function into a file, then use it to bring in various other function libraries. 'Usage: ' Import "Library.vbs" Sub Import(strFile) Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject") Dim wss : Set wss = CreateObject("WScript.Shell") strFile = wss.ExpandEnvironmentStrings(strFile) strFile = objFSO.GetAbsolutePathName(strFile) Set objFile = objFSO.OpenTextFile(strFile, 1) ExecuteGlobal objFile.ReadAll objFile.Close : Set objFSO = nothing Set wss = Nothing End Sub The error states "Microsoft VBScript compilation error. Invalid Character. Code: 800A0408" on Char: 2, Line 206 which is the very first letter on ExecuteGlobal objFile.ReadAll (character 1 is a tab). I have typed and retyped the line, as well as the surrounding line breaks. Still, it keeps saying 'Inv
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: http://www.morgantechspace.com/2015/07/vbscript-invalid-character-800a0408.html 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 vbscript compilation click "Save as" 3. Under the file name, you will see a drop down menu for Encoding. Choose ANSI. 4. Save the file. Recent Posts Oops! Make sure JavaScript is enabled in your browser. Advertisements Advertisements Posted by Morgan at 06:22 Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest Labels: VBScript No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) vbscript compilation error Popular Posts Create Bulk AD Users from CSV using Powershell Script Powershell: Set AD Users Password Never Expires flag samAccountName vs userPrincipalName Export AD Users to CSV using Powershell Script HTTP Error 503. The service is unavailable. Powershell : Check if AD User is Member of a Group Powershell - Get AD Users Password Expiry Date Create AD User using Powershell Script Powershell Script to Disable AD User Account Event 4624 null sid - Repeated security log Keywords Account Lockout Analyzer Active Directory Active Directory Report AD Attribute AD Audit AD Management AD Permission ASP.NET ASPX Audit Policy Azure AD BIOS C# Command Prompt Cryptographic CSOM CSS CSV Database Desktop Development DNS Endpoint Secutiy Event ID Exchange Online Exchange Server File Access Auditing File System FIPS Compliance Firewall GPO Graph API Html HTTP Error IIS Indexing IP Address JavaScript JQuery LAN Ldap LDAP Filters Logon Audit Logon Type Mailbox Message Tracking MMC MS Access Name Resolution Network Network Shares News NTFS NTFS Persmission Nuget ODBC Office 2016 Office 365 Office 365 Groups Office 365 License Office Dev PnP OLEDB Outlook Package Manager Password Policy PC Powershell Powershell Remoting Powershell Tips Proxy Registry Remote Administration Remote Desktop (RDP) Schedule Task Security Server Server Manager Services SharePoint SharePoint 2013 SharePoint Online