Solved

Pass Parameters

Posted on 2014-01-26
8
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 70

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

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 36

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 70

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

726 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