VB Script help
Hi Guys, I would really appriciate your help. I have a dos batch file that does this
cd folder\folder1\folder2\install.exe command line switches
cd ..
So it runs the exe from that folder then after runing goes one step back to parent folder. Can some one write a VBSCRIPT for it. Thanks
Answers (2)
Use the following script: Option Explicit Dim wshShell On Error Resume Next Set wshShell = WScript.CreateObject("WSCript.shell") If Err.Number <> 0 Then Wscript.Quit End If wshShell.Run "cd folder\folder1\folder2\install.exe" wshShell.Run "cd .." On Error Goto 0
Option Explicit Dim wshShell On Error Resume Next Set wshShell = WScript.CreateObject("WSCript.shell") If Err.Number <> 0 Then Wscript.Quit End If wshShell.Run "cd folder\folder1\folder2\install.exe" wshShell.Run "cd .." On Error Goto 0
Comments:
-
Both of these options worked, thankyou so much for your time and help. - sam42856 12 years ago
GAKIS' answer should do the trick for you. If not,
Option Explicit
Dim wshShell
On Error Resume Next
Set wshShell = WScript.CreateObject("WSCript.shell")
If Err.Number <> 0 Then
Wscript.Quit
End If
wshShell.Run "cmd.exe /C cd folderpath\install.exe"
wshShell.Run "cmd.exe /C cd newfolderpath"
On Error Goto 0
may also do the trick. It does the same thing through cmd so you could tweak it to view the process if you wanted.