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

Answer Summary:
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
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

2
 
 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
 
Answered 05/10/2012 by: GAKIS
Second Degree Green Belt

  • Both of these options worked, thankyou so much for your time and help.
Please log in to comment

Answers

0

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.

Answered 05/10/2012 by: psalwey
White Belt

Please log in to comment
Answer this question or Comment on this question for clarity