468,301 Members | 1,488 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,301 developers. It's quick & easy.

To run an application using VB script

Hi there
I want to run an application (say BegUI). I tried to open the script conf.vbs as below
Set objShell = WScript.CreateObject("WScript.Shell")
ObjShell.run("BegUI.exe") Or ObjShell.run("FullPath")
Set ObjShell=Nothing
But it says that file not found in line 2.

I confirmed that is the right path. I tried to run it from Start->Run->Full Path of BegUI.exe. It has been executed well. When I double click the application file, it works fine.
The problem here is it is not executed when I run using above script.

Note: BegUI is an windows application. This application is an User Interface Application.When you double click the exe, It displays just small menu window as you see when u right click any file. So My guess is I'm not recognizing the correct format or file.

Can anybody help me runinng the above script giving me some suggestions?

Thanks
Nov 14 '06 #1
7 62061
Killer42
8,434 Expert 8TB
I'm not personally familiar with VBscript. Can someone tell me - does it run in a "sandbox"? Only, I wonder whether it is restricted in some way from running the program.
Nov 14 '06 #2
Try something like :
---------------------------------------------
Dim p_ID

Dim FullPath As String

FullPath="C:\<prog_path>\BegUI.exe"

p_ID = Shell(FullPath,1)

---------------------------------------------

now you can manage BegUI.exe using p_ID (task identifier), like this:

AppActivate p_ID
Application.SendKeys "%{F4}", True ' close BegUI.exe

I think what you tried didn't work 'cause BegUI.exe is not the Win cmd shell ,
use .Run to execute shell commands .


Hi there
I want to run an application (say BegUI). I tried to open the script conf.vbs as below
Set objShell = WScript.CreateObject("WScript.Shell")
ObjShell.run("BegUI.exe") Or ObjShell.run("FullPath")
Set ObjShell=Nothing
But it says that file not found in line 2.

I confirmed that is the right path. I tried to run it from Start->Run->Full Path of BegUI.exe. It has been executed well. When I double click the application file, it works fine.
The problem here is it is not executed when I run using above script.

Note: BegUI is an windows application. This application is an User Interface Application.When you double click the exe, It displays just small menu window as you see when u right click any file. So My guess is I'm not recognizing the correct format or file.

Can anybody help me runinng the above script giving me some suggestions?

Thanks
Jan 8 '07 #3
Instead of ObjShell.run("BegUI.exe")
try
ObjShell.exec("BegUI.exe")

Shell.Exec command provides additional capability beyond the Shell.Run method. These abilities include:
* Improved environment variable passing
* Ability to access the standard streams of the executable
Aug 6 '07 #4
Instead of ObjShell.run("BegUI.exe")
try
ObjShell.exec("BegUI.exe")

Shell.Exec command provides additional capability beyond the Shell.Run method. These abilities include:
* Improved environment variable passing
* Ability to access the standard streams of the executable
I searched high and low to find out how to run Flash Media Encoder from my script.
This solution worked great. Thanks windson!!!
Oct 24 '07 #5
Rettla
28
Thanks guys, I have been looking all over for this. I used a script with the code below to start winrar.

Set objShell = WScript.CreateObject("WScript.Shell")
ObjShell.exec("F:\Program Files\WinRAR\Winrar.exe")
Set ObjShell=Nothing

Is it possible to add parameters such as the target and source folders for an unzip operation such that I can automate Winrar using the script?
Feb 11 '12 #6
Guido Geurs
767 Expert 512MB
You must open a shell and follow the rules for the commandline of the program.
for Winzip it's= program command ZIPfile Folder
(command for extract => -e)

Expand|Select|Wrap|Line Numbers
  1. 'Calling unzip function
  2. Set WshShell = WScript.CreateObject("WScript.Shell")
  3. WshShell.Run  """C:\Program Files\WinZip\WZUNZIP.EXE""" & " -e " & """E:\xfer4\DDAP.SPRD.JCH.E.zip""" & " " & """E:\xfer4"""
This will extract all the files from E:\xfer4\DDAP.SPRD.JCH.E.zip to E:\xfer4
Feb 11 '12 #7
Rettla
28
@Guido Geurs
Tghank you so much Guido. It worked. I really appreciate it
Feb 12 '12 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by KS | last post: by
5 posts views Thread by Loane Sharp | last post: by
7 posts views Thread by Aryan | last post: by
5 posts views Thread by Ruso | last post: by
11 posts views Thread by rh00667 | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.