|
-
Apr 7th, 2004, 09:00 AM
#1
Thread Starter
New Member
Variable is undefined on Set oShell ...
I'm tring to run a vb script on the command line and I get this error :
Srcipt: xyz.vbs
Line: 98
Char: 1
Error: Variable is undefined: 'oShell'
Code: 800A01F4
Source: Microsoft VBScript runtime error
and this is the code on line 98:
Set oShell = CreateObject("WScript.Shell")
Do I have to define a variable for oShell ?
What I'm doing wrong ?
Any help is realy apreciate.
-
Apr 7th, 2004, 09:05 AM
#2
Junior Member
I use this:
VB Code:
Dim wShell
Set wShell = WScript.CreateObject("WScript.Shell")
-
Apr 7th, 2004, 10:28 AM
#3
Thread Starter
New Member
The system cannot find the file specified
Thanks that worked, but I'm getting into another problem:
Line100: The system cannot find the file specified!
as the code looks like this:
...
34: cPath = "c:\\Program Files\\Ensim\\Webppliance\\util\\"
...
45: cCmd = "adddomain -s " & cXML
...
98: Dim oShell
99: Set oShell = CreateObject("WScript.Shell")
100: Set oExec = oShell.Exec(cPath & cCmd)
...
The path is ok I have checked many times.
-
Apr 7th, 2004, 11:09 AM
#4
Junior Member
Are you sure all those double '\' are correct?
-
Apr 7th, 2004, 11:28 AM
#5
Thread Starter
New Member
I have tried as well with single "/" but same message.
I've note that when I go to the command prompt I cannot run the program simply typing c:\\Program Files\\Ensim\\Webppliance\\util\\adddomain it works only using short file names C:\\PROGRA~1\\Ensim\\WEBPPL~1\\util\\adddom~1.bat or using double quotes "c:\\Program Files\\Ensim\\Webppliance\\util\\adddomain".
Unfortunatelly I cannot change the code to use short file names and I don't know how to specify in the code to send the command with double quotes.
-
Apr 7th, 2004, 11:31 AM
#6
Junior Member
did you try with single '/' or '\' ?
you could just try
Code:
...
98: Dim oShell
99: Set oShell = CreateObject("WScript.Shell")
100: Set oExec = oShell.Exec("c:\\Program Files\\Ensim\\Webppliance\\util\\adddomain -s")
Last edited by Amleto; Apr 7th, 2004 at 12:15 PM.
-
Apr 7th, 2004, 11:45 AM
#7
Thread Starter
New Member
That I cannot do because the cCmd variable gets changed.
-
Apr 7th, 2004, 11:50 AM
#8
Junior Member
what about:
Code:
cPath = "'" & "c:\\Program Files\\Ensim\\Webppliance\\util\\" & "'"
etc.
-
Apr 7th, 2004, 12:14 PM
#9
Thread Starter
New Member
-
Apr 7th, 2004, 12:17 PM
#10
Junior Member
well make a new folder in a path that doesnt contain any spaces, and try and run an .exe file in there to test exactly what the problem is
-
Apr 7th, 2004, 12:47 PM
#11
Thread Starter
New Member
sorry Amleto,
I cannot do this because some other applications are running in the same folder.
-
Apr 7th, 2004, 12:49 PM
#12
Junior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|