Login | |
|
 |
RE: File Run, using script - 5/9/2007 2:05:27 AM
|
|
 |
|
| |
ebgreen
Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
|
In that case you just need to determine the current working directory for the script and prepend it to the exe that you want to run. About the easiest way is probably: strExeAndPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "vm_3805_1.exe")
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: File Run, using script - 5/9/2007 2:40:51 AM
|
|
 |
|
| |
netman06
Posts: 108
Score: 0
Joined: 10/19/2006
Status: offline
|
Hi, ebgreen Here is the script code. I do not know if I have it setup right, can you please take a look at it and see, what might be wrong? Here is the error message, that I'm getting. Line 3, Char 1 Microsoft VBScript runtime error: Object doesn't support this property or method: 'WScript.MSJVM' Code: 'Run script and execute files anywhere the script resides 'File Name: MSJVM.vbs strExeAndPath = Replace(WScript.ScriptFullName, WScript.MSJVM, "vm_3805_1.exe") ' here did I setup this right with the script name. Set WshShell = WScript.CreateObject("WScript.Shell") If (MsgBox("Do you want to Install Microsoft Virtual Machine?",_ vbYesNo + vbQuestion, "Question") = vbYes) Then WshShell.Run"strExeAndPath\vm_3805_1.exe" WshShell.Run"strExeAndPath\vm_3809_2.exe" WshShell.Run"strExeAndPath\vm_3810_3.exe" End If Code: Thanks, Mike
|
|
| |
|
|
|
 |
RE: File Run, using script - 5/9/2007 2:52:51 AM
|
|
 |
|
| |
netman06
Posts: 108
Score: 0
Joined: 10/19/2006
Status: offline
|
I got the path to work and do not get the error message above, but no I'm getting an error, regarding the file. Line 9, Char4 (null): The system cannot find the file specified. So from the error message, it is not picking up the file name, because error is null value, is that correct? And by my above posting, I have three files, that I need to have run via the script. Thanks, Mike
< Message edited by netman06 -- 5/9/2007 2:56:48 AM >
|
|
| |
|
|
|
 |
RE: File Run, using script - 5/9/2007 3:12:56 AM
|
|
 |
|
| |
ebgreen
Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
|
Well since it looks like you are actually running multiple exes from the same location, it would be best to save the location as a var then use it when running the files: 'Run script and execute files anywhere the script resides 'File Name: MSJVM.vbs strPath = Replace(WScript.ScriptFullName, WScript.Name, "") If (MsgBox("Do you want to Install Microsoft Virtual Machine?",_ vbYesNo + vbQuestion, "Question") = vbYes) Then WshShell.Run strPath & "vm_3805_1.exe" WshShell.Run strPath & "vm_3809_2.exe" WshShell.Run strPath & "vm_3810_3.exe" End If
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|