Sign in to follow this  
Followers 0
DWUSON

App launcher - run batch file and pass command line parameter

2 posts in this topic

I am writing a dynamic application launcher that loads a text file for it's Menu items and a text file for the commands associated to each menu item.

Menu Items text file read into an array.

A

B

C

Test

Commands items text file read into a different array (a$commands) and not all of them would necessarily have parameters at the end

MO.CMD 1

MO.CMD 2

MO.CMD 3

Test.CMD

So that when you select from the menu -

Select A - runs "MO.cmd 1"

Select B - runs "MO.cmd 2"

Select C - runs "RO.cmd 3"

Select Test - runs "Test.cmd"

Each one of these .cmd files could have different logic in them that I don't want to try and incorporate into my launcher.

When I try to run SHELLEXECUTE($aCommand) or RUN($aCommand) and and pass it "MO.cmd 1", "MO.CMD 2" or "RO.CMD 3" I get an error that it can't find the application. Basically it's having trouble with the DOS command-line parameter that I need to pass on. If I launch "test.cmd" it works fine because there is no command line parameter.

How do I execute a batch file (or executable) and pass a command line parameter if one is present?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Welcome to the forum!

ShellExecute() ought to work fine for you.

The line below is ripped out of one of my functioning scripts:

ShellExecuteWait(@ScriptDir & "\ZipList.bat", $work_provider & " " & $work_year & " " & $work_month, "", "", @SW_HIDE)

It passes three parameters to a .bat file that runs in a hidden window.

As you can see, the passed parameters go into the second ShellexecuteWait (or ShellExecute) parameter.

There are other examples within the helpfile.

Edited by Spiff59

Share this post


Link to post
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
Sign in to follow this  
Followers 0