Vbs ошибка 800a0408

I get a compilation error when I try to run the following vbs code from a command prompt in Windows 7.

Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3
Dim strDriveLetter1, strDriveLetter2, strDriveLetter3, strUserName

Set objNetwork = CreateObject("WScript.Network")
strUserName = objNetwork.UserName 

strDriveLetter1 = "H:"
strDriveLetter2 = "P:"
strDriveLetter3 = "S:"
strRemotePath1 = "\testpublicusers" & strUserName & ""
strRemotePath2 = "\testpublicgroups"
strRemotePath3 = "\testscans"


'Section which maps two drives, M: and P: and S:
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3

'Extra code just to add a message box
WScript.Echo "Map drives " & strDriveLetter1 & " & " & strDriveLetter2 & " & " & strDriveLetter3

Wscript.Quit

It says the issue is with Line 1 Char 1. Any ideas?

Help, I’m trying to run a stored procedure, but i’m getting
the following error —

«Microsoft VBScript compilation error ‘800a0408’

Invalid character

/admin/afterreviewupdatepricing.asp, line 39

if(Request.QueryString(“day7“) <> «») then
updatepricingCommand__7dayrate =
Request.QueryString(“day7“)»

Where row 39 is —

if(Request.QueryString(“day7“) <> «») then
updatepricingCommand__7dayrate =
Request.QueryString(“day7“)

I’ve attached the code —

Any ideas as to what I’m doing wrong????

Thanks

  • Remove From My Forums
  • Question

  • Hello, reviving an old one on this forum: http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/special-characters-in-vbscript-strings/ and
    also as posted on: http://itknowledgeexchange.techtarget.com/itanswers/escaping-special-characters-in-run-with-administrator-privileges-script/

    I used this script:

    Here is a VB Script Vall Script that will get around the Password Prompt when «RunAs» is called…

    ‘Start

    ‘————————————————————————————

    ‘ To Run other VB Scripts or even Batch Files with Admin Priviliges’

    ‘———————————————————————————-

    Dim WshShell, objFSO

    suser
    = «YourAdminAccount@YourDomain.com»

    sPass = «YourPassWord»

    ‘——————————————————————————————————————————————————————————————

    ‘Put your Domain Account and Password in between the qoutes, REMEMBER! the Password will be clear text. If this is a standalone just take off the @YourDomain.com

    ‘——————————————————————————————————————————————————————————————

    sCommand = «wscript \UNCServerNameShareFolderYourScript.vbs»

    ‘—————————————————————————————————————————————————————————————————————

    ‘This will be the path were the scripted you want called will be at. Please note you can substitute the ablove for a local directory (Example: C:FolderYourScript.vbs)

    ‘————————————————————————————————————————————————————————————————————-

    Set objComputer = CreateObject(«Shell.LocalMachine»)

    Set WshNetwork = CreateObject(«WScript.Network»)

    Set WshShell = CreatObject(«WScript.Shell»)

    Set WshEnv = wshShell.Environment(«Process»)

    WinPath = WshEnv(«SystemRoot»)&»System32runas.exe»

    rc = WshShell.Run («runas /noprofile /user:» & suser & » » $ Chr(34) & sCommand & Chr(34))

    WScript.Sleep 900

    WshShell. AppActivate(WinPath)

    WScript.quit

    ‘End

Answers


  • suser = «YourAdminAccount@YourDomain.com»
    sPass = «YourPassWord»

    rc = WshShell.Run («runas /noprofile /user:» & suser & » » $ Chr(34) & sCommand & Chr(34))
    WScript.Sleep 900
    WshShell. AppActivate(WinPath)

    This is definitely ill-advised. There is a reason the runas program does not accept a password on its command line. To quote

    Raymond Chen:

    The RunAs program demands that you type the password manually. Why doesn’t it accept a password on the command line?

    This was a conscious decision. If it were possible to pass the password on the command line, people would start embedding passwords into batch files and logon scripts, which is laughably insecure.

    In other words, the feature is missing to remove the temptation to use the feature insecurely.

    In other words, you should not do this.

    Bill

    • Proposed as answer by

      Wednesday, May 2, 2012 6:16 PM

    • Marked as answer by
      IamMred
      Sunday, May 6, 2012 11:59 PM

RRS feed

  • Remove From My Forums
  • Question

  • when i start my computer i get this error message Microsoft VBScript compilation error. Code 800A0408

All replies

  • Can you be more specific? ‘When I start my computer’ — does this message appear when the pc boots up? At what point does it appear?

    If this is literally when the computer boots it’s not an EW issue.

    Ian
    MS MVP Expression

    http://www.ew-resource.co.uk
    http://www.fp-resource.co.uk


    Ian Haynes

  • when the computer boots and any time i click on task manager.

  • when the computer boots and anytime i click on the task manager.
    thank you.

  • Sounds to me like you might have a startup script that’s doing this. Simply starting Task Manager won’t invoke any VBScript. Will this error occur if you just log in and don’t do anything else? Does it give you a file name? That error code means that there was an invalid character in a VBScript (.vbs more than likely) file.

    Jim Cheshire
    Jimco Software and Books
    http://www.jimcosoftware.com
    http://www.jimcobooks.com

    Author of:
    Microsoft Expression Web 3 In Depth
    Special Edition Using Microsoft Expression Web 2
    The Microsoft Expression Web Developer’s Guide to ASP.NET 3.5
    Special Edition Using Microsoft Expression Web

    My Expression Web 3 blog on Network World:
    http://www.networkworld.com/community/blog/10560

  • This error occur anytime i log in and don’t do anything else. The file name is C:WINDOWSsystem32winjpg.jpg

  • Sounds like you might have a virus.

    http://www.sophos.com/security/analyses/viruses-and-spyware/w32autorunalb.html

    Jim Cheshire
    Jimco Software and Books
    http://www.jimcosoftware.com
    http://www.jimcobooks.com

    Author of:
    Microsoft Expression Web 3 In Depth
    Special Edition Using Microsoft Expression Web 2
    The Microsoft Expression Web Developer’s Guide to ASP.NET 3.5
    Special Edition Using Microsoft Expression Web

    My Expression Web 3 blog on Network World:
    http://www.networkworld.com/community/blog/10560

  • Since this is a Windows not an Expression Web problem I would suggest that you ask in a Windows group or if Jim is correct in one of the anti-virus forums. In any event this is not the place to resolve your Windows boot issue.


    MS MVP Expression Tutorials & Help http://by-expression.com and online instructor led
    Expression Classes

check
Best Answer

  • Author Mike Brown

    So I had to go through the whole file and replace invalid characters.  This is rather frustrating.  What I think happened is I edited in Notepad at one point rather than Notepad++.

    I’ll have to change the default editor for vbs files or I’m going to do that again I’m sure of it.


    Was this post helpful?
    thumb_up
    thumb_down

  • View Best Answer in replies below

    5 Replies

    • Author Adam

      In the command line or a batch file try using «type old.vbs > new.vbs» to convert the file(s) to ansi.

      http:/ Opens a new window/www.robvanderwoude.com/type.php#Unicode


      Was this post helpful?
      thumb_up
      thumb_down

    • You need to post a snippet of your code, maybe the line and character referenced in the error?
      We do not have enough information to help with just the error.

      EDIT:
      After searching the error, it does seen to be an encoding issue.
      I have never seen that with NotePad++.


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Mike Brown

      AdamRPL wrote:

      In the command line or a batch file try using «type old.vbs > new.vbs» to convert the file(s) to ansi.

      http:/ Opens a new window/www.robvanderwoude.com/type.php#Unicode

      Tried that and when I run the new file I get the same message.  Notepad++ is showing that it is ANSI.

      attach_file
      Attachment

      2014-01-23_13_34_…ection.png
      41.1 KB


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Mike Brown

      Dave Rossi wrote:

      You need to post a snippet of your code, maybe the line and character referenced in the error?
      We do not have enough information to help with just the error.

      EDIT:
      After searching the error, it does seen to be an encoding issue.
      I have never seen that with NotePad++.

      It’s always line 1 character 1.

      Here is the beginning of the code:

      ‘——————————————————————————–
      ‘declare variables
      ‘——————————————————————————–
      
      Const ForAppending = 8
      
      Const LogFile = “c:tempjavauninstall.txt”
      
      ‘——————————————————————————–
      ‘create log file
      ‘——————————————————————————–
      
      Set objFSO = CreateObject(“Scripting.FileSystemObject”)
      
      Set objLogFile = objFSO.CreateTextFile(LogFile)
      
      sLog = “Started Java Uninstall”
      
      Call WriteLog(sLog)
      

      This script worked just fine until I edited it recently.


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Mike Brown

      So I had to go through the whole file and replace invalid characters.  This is rather frustrating.  What I think happened is I edited in Notepad at one point rather than Notepad++.

      I’ll have to change the default editor for vbs files or I’m going to do that again I’m sure of it.


      Was this post helpful?
      thumb_up
      thumb_down

    Понравилась статья? Поделить с друзьями:
  • Vba ошибка 450
  • Vampire the masquerade bloodlines ошибка engine error
  • Valheim не запускается ошибка unity
  • Val57 код ошибки
  • V0144 ошибка suzuki grand vitara