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

x
?
Solved

Populating Command Line Arguments

Posted on 2006-11-14
2
Medium Priority
?
212 Views
Last Modified: 2010-04-23
I have an application that can accept any number of command line arguments (using the Command() function).

Currently to test different scenarios, I have to constantly go into the Properties page and change the Command Line Arguments on the Debug tab.

I want to write a tester application that will open this form and I'd like to "populate" the command line arguments from vb.net.  Is this possible?

Note that I am not using the SHELL command or anything like that.  I am simply instantiating a form that uses the Command() function.
0
Comment
Question by:chlade
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 2000 total points
ID: 17938619
Hi chlade,

You could do it with some conditional compilation. The command function is effectively readonly, however you could do this:

Dim MyCommandString As String
#If DEBUG Then
        MyCommandString = "Parameter1,Parameter2"
#Else
        MyCommandString = Command()
#End If

And then work with MyCommandString from then onwards. You could extend this to retrieve the parameters from wherever your tester form stores them. This will allow you to debug the code in the way that you want and will need no changes when it is released as the conditional compilation will only include the second option (using command()).

Tim Cottee
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 17939001
You can use Process.Start Method (String, String) in the testing application. It should contain Windows form with textbox and Start button. Textbox contains command line arguments filled by user. When Start button is clicked, execute the following code:

Process.Start Method ("tested-application-name.exe", textBox1.Text)

Other way is using Windows Run command, or batch file.
0

Featured Post

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!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

926 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