Solved

Pass Parameters

Posted on 2014-01-26
8
240 Views
Last Modified: 2014-02-13
I have a windows application where I can to specify the parameters such as Run As of Date, From Date, To Date etc from the run path without opening the application

i.e. if you go to properties, and in the target you specify your parameters.

In my case I have 5 different parameters LSTDAT1,LSTDAT2,LSTDAT3,LSTDAT4,LSTDAT5 to be passed BUT the value is the SAME

LSTDAT1 = '31/12/2013'
LSTDAT2 = '31/12/2013'
LSTDAT3 = '31/12/2013'
LSTDAT4 = '31/12/2013'
LSTDAT5 = '31/12/2013'

My question is how can I enter only one time the date  31/12/2013 and pass it in the path for the five values?

Thank you
Ramzi
0
Comment
Question by:ramziabk
8 Comments
 
LVL 40
ID: 39812266
If the application is a .exe for which you do not have the code, then you have to follow the rules set by the designer of the application. Look at the documentation or contact the vendor.

If this is something that was built in-house and you have the code, then the code can be adapted to take care of the situation.
0
 
LVL 40
ID: 39813664
Too bad, I missed the comment by only a few minutes :-). It seems that my intervention was not appreciated, or maybe not understood, so I will give it a second try.

The parameters expected by an application on a command line are not defined by the operating system. They are defined by each different applications.

If an application expects 5 parameters, there is nothing you can do.

So your only resources is either to look in the documentation or ask the createor of the application if there are differrent ways to pass the parameters than the one you know.

Or find the source code and adapt it to what you want.
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 39813688
I agree to the previous comments. This is something only the designer of that particular application can know. There is no generic method to provide optional parameters to applications, the interpretation of commandline arguments is fully in the realm of the application itself.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39813698
Can you not create a BAT/CMD/PowerShell script or a wrapper program (like a .Net console app) that accepts the ONE parameter then turns around and calls the program with it repeated 5 times?
0
 
LVL 35

Assisted Solution

by:mccarl
mccarl earned 167 total points
ID: 39813706
You could use a batch file to launch your application, eg. say you currently start your application like this... (this is the value in your shortcuts "target")
C:\my_app_folder\my_app 31/12/2013 31/12/2013 31/12/2013 31/12/2013 31/12/2013

Open in new window

Then what you can do is to create a batch file in the same directory as you app, called say my_app_launcher.bat with the following...
@echo off
my_app %1 %1 %1 %1 %1

Open in new window

And then change you shortcut to launch the batch file instead of the application directly, like...
C:\my_app_folder\my_app_launcher 31/12/2013

Open in new window


The %1 in the batch file expands to be the first (and only) parameter passed to the batch file, but gets used multiple times which I believe is what you want.

Note that you need to make sure that the "Start In" directory is correctly set to your apps directory so that the relative reference to "my_app" inside the batch file works correctly. If you can't do that for other reasons, you will need to hard code the full path to my_app inside the batch file.
0
 
LVL 68

Assisted Solution

by:Qlemo
Qlemo earned 166 total points
ID: 39813715
If nothing else helps, and you need to do that more often, then the approach of slightwv is sound. A simple batch file will do:
@echo off
C:\PathTo\YourApplication.exe LSTDAT1 = %1 LSTDAT2 = %1 LSTDAT3 = %1 LSTDAT4 = %1 LSTDAT5 = %1

Open in new window

or whatever the parameter syntax is for that application.
0
 
LVL 45

Accepted Solution

by:
aikimark earned 167 total points
ID: 39814172
@ramziabk

To expand what mccarl posted, you might be able to use the batch file wrapper method that passes up to five different parameters, but repeats the first parameter.
@echo off
my_app %1 %2 %3 %4 %5 %1 %1 %1 %1

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VS2015 compilation and missing DLLs 9 119
Perform a system restore through Safe Mode with command prompt 3 120
Build VS2015 project in bat command 3 80
Dialogbox API leak? 18 81
Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now