Search code examples
vbscriptsendkeysinvalid-characters

VBScript SendKeys 800A0408 Invalid Character


I'm getting this compilation error with a script I was working on using WScript.SendKeys. Yes, I have saved the .vbs file to be encoded as ANSI. It says the error is on Line 48, which is this:

shell.SendKeys {ENTER}

The rest of the script works just fine if I take this line out, in case that's important.


Solution

  • You need to enclose {ENTER} in quotes. SendKeys expects a string parameter.

    shell.SendKeys "{ENTER}"