WSH Object required running a VB script
Posted on 2009-05-07
I have a script to copy a file. It runs fine on my PC, but on another person's PC it gives a WSH (Windows Script Host) error with the error "Object Required". Both PCs are running Windows XP SP3.
Here is the script:
Dim oArgs, fileToCopy, destination, objShell, objFolder
Set oArgs = WScript.Arguments.Unnamed
fileToCopy = oArgs.Item(0)
destination = oArgs.Item(1)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(destination)
If I comment out the last line of the script, I don't get any errors.
I presume the other PC has got VB Script installed, as it can run the following simple script:
WScript.Echo "Hello World"