Solved

Populating Command Line Arguments

Posted on 2006-11-14
2
204 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 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

21 Experts available now in Live!

Get 1:1 Help Now