Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Run an app from VB Script with command line options wait till it is done then run another app.

Posted on 2013-06-11
3
Medium Priority
?
528 Views
Last Modified: 2013-06-16
Hi,

I would like to run the following command from a vb script.

"C:\Program Files (x86)\Citrix\ICA Client\wfcrun32.exe" "C:\Users\Public\XenApp Desktop IBAU.ica"

The "C:\Users\Public\XenApp Desktop IBAU.ica" is an argument to the command that will be passed through in the script (it does not change)

I want to monitor the process wfcrun32.exe in the context of the user who is running it as it will be running many times.

Once the process ends, I want to send another command (a logoff)

That is all I need to do and I need to do it all from a vbscript.

Help and Thanks.
Ps
0
Comment
Question by:PeterSinger
3 Comments
 
LVL 11

Expert Comment

by:X_layer
ID: 39237273
You want to logoff from computer?
Try this script:
Dim objShell
Dim Program
Dim Argument

Set objShell = WScript.CreateObject("WScript.Shell")
Program = """C:\Program Files (x86)\Citrix\ICA Client\wfcrun32.exe"""
Argument = """C:\Users\Public\XenApp Desktop IBAU.ica"""

objShell.Run "cmd /c " & Program & " " & Argument, 1, true
objShell.Run "cmd /c shutdown.exe /l"

Open in new window

0
 
LVL 4

Author Comment

by:PeterSinger
ID: 39239357
That does not work as the application does not stay alive.  Further, it does not start with the commands used. Any one else?
0
 
LVL 25

Accepted Solution

by:
Coralon earned 2000 total points
ID: 39242922
What's the goal here?  x_layer's script should work just fine, (although I'd substitute logoff.exe instead of shutdown.exe -- personal preference).

I have another documented script here http://www.experts-exchange.com/Software/System_Utilities/Remote_Access/Citrix/A_10618-Using-a-startup-script-to-monitor-for-connected-Citrix-Sessions.html that will do pretty much what you are looking for.  (That script would need to be slightly modified to launch the initial ICA file, but conceptually it will accomplish what you want.

Coralon
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question