Jump to content

Recommended Posts


Run Something And Wait For It To Finish

Dim Act : Set Act = CreateObject("Wscript.Shell")
Act.Run("Notepad.exe"),1,True

Run Something And Not Wait For It To Finish

Dim Act : Set Act = CreateObject("Wscript.Shell")
Act.Run("Notepad.exe"),1,False

Run Somthing With A Space In It Path

Dim Act  : Set Act = CreateObject("Wscript.Shell")
Dim File : File = Act.ExpandEnvironmentStrings("%ProgramFiles%\Winamp\winamp.exe")
Act.Run(Chr(34) & File & Chr(34)),1,True

Check For File Then Run It And Wait For it To Complete

Dim Act  : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim File : File = Act.ExpandEnvironmentStrings("%ProgramFiles%\Winamp\winamp.exe")
If Fso.FileExists(File) Then
Act.Run(Chr(34) & File & Chr(34)),1,True
Else
Act.Popup "Can Not Find Winamp",5,"Missing", 4128
End If

Check For File Then Run It And Not Wait For it To Complete

Dim Act  : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim File : File = Act.ExpandEnvironmentStrings("%ProgramFiles%\Winamp\winamp.exe")
If Fso.FileExists(File) Then
Act.Run(Chr(34) & File & Chr(34)),1,False
Else
Act.Popup "Can Not Find Winamp",5,"Missing", 4128
End If

Edited by gunsmokingman
Link to comment
Share on other sites

  • 2 weeks later...

It works, but it doesn't accept "white spaces" in the path (thought it accept long names if no white space!).

So use:

Set Fso = CreateObject("Scripting.FileSystemObject")

Set f = Fso.GetFile(MyPath)

oWsh.Run f.ShortPath

That way you are sure there will be no white space in the path

You can lauch files or exe alike.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...