How could I run exe file form vbscript 
Author Message
 How could I run exe file form vbscript

How could I call a exe or bat file from VBScript.

Thanks,

Haoyu



Mon, 09 Jun 2003 01:11:43 GMT  
 How could I run exe file form vbscript

The code below opens up local apps and ensures each is running before
opening the next.  This isn't for the Web, though.

Option Explicit

Dim OpenThis, AppArray(7,2), x, n

AppArray(1,1) = """C:\Program Files\Internet Explorer\IEXPLORE.EXE"""
AppArray(1,2) = "about:blank - Microsoft Internet Explorer"
AppArray(2,1) = """C:\Program Files\Outlook Express\msimn.exe"""
AppArray(2,2) = "Inbox - Outlook Express"
AppArray(3,1) = "D:\"
AppArray(3,2) = "Explorer"
AppArray(4,1) = "E:\DataJunction6.5\djwin650.exe"
AppArray(4,2) = "Data Junction"
AppArray(5,1) = """E:\Microsoft Office\Office\Winword.exe""/mOpenAll"
AppArray(5,2) = "Data-Junction Re-Usable Code.doc - Microsoft Word"
AppArray(6,1) = """F:\JasonsWorkingFolder\DB Update Project\State DB Raw
Files"""
AppArray(6,2) = "State DB Raw Files"
AppArray(7,1) = "E:\PersonalBrain\Brain.exe"
AppArray(7,2) = "PersonalBrain"

set OpenThis = WScript.CreateObject("WScript.Shell")

For x = 1 to 7
    OpenThis.Run AppArray(x,1),3
    Select Case x
      Case 4
        n = 3
      Case Else
        n = 1
    End Select
    WaitAppActive AppArray(x,2),n
Next

Sub WaitAppActive(sTitle,n)
  With CreateObject("WScript.Shell")
     If Not .AppActivate(sTitle) Then
        Do Until .AppActivate(sTitle)
          WScript.Sleep 300 * n
        Loop
     End If
  End With
End Sub

Set OpenThis = Nothing

~JasonP

Quote:
> How could I call a exe or bat file from vbscript.

> Thanks,

> Haoyu



Mon, 09 Jun 2003 05:44:34 GMT  
 How could I run exe file form vbscript

Run method of WshShell object (WSH 1.0).
Exec method of WshShell object (WSH 5.6--currently beta).

WSH Documentation
http://msdn.microsoft.com/scripting/windowshost/wshdoc.exe
http://msdn.microsoft.com/scripting/windowshost/docs/reference/defaul...

WSH 5.6 Beta Documentation
http://www.microsoft.com/scripting/downloads/v56b/wsh.chm


Quote:
> How could I call a exe or bat file from vbscript.

> Thanks,

> Haoyu



Mon, 09 Jun 2003 05:28:11 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Running EXE files from VBScript

2. Run any EXE File with VBscript

3. VBScript (transferring form data to external exe file

4. VBScript (transferring form data to external exe files)

5. create directory, copy files, run exe files

6. Running cscript.exe and wscript.exe from the floppy drive

7. How do I run notepad.exe on the server using vbscript

8. Help running an exe from vbscript

9. Running a .bat or .exe through VBScript in IIS ASP

10. Run .exe in same thread as VBScript??

11. run exe on VBScript?????????????

12. running an exe from vbscript

 

 
Powered by phpBB® Forum Software