On Windows 7, I get an error for the following line in my VBScript:
Set wsh = WScript.CreateObject("WScript.Shell")
Error:
Microsoft VBScript runtime error: Wrong number of arguments or invalid property assignment: 'wsh'
Using any name other than wsh
works.
I scoured the web for information, but the pages for reserved keywords do not reference any mention of wsh
.
I run the above script using the cscript command in the CMD processor.
UPDATE AFTER QUESTION WAS ANSWERED:
Declaring the variable as Dim wsh
overrides its keyword status, allowing its use in the script. Came across this information after posting the question, here: http://forums.devshed.com/visual-basic-programming-52/bizzare-finding-username-918597.html
wsh
is a builtin alias for theWScript
object. – Entertainingwsh
before in all my years. – Legislator