Solved

Pass Parameters

Posted on 2014-01-26
8
238 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

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
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

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
@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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
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…

771 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

9 Experts available now in Live!

Get 1:1 Help Now