Solved

Populating Command Line Arguments

Posted on 2006-11-14
2
209 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
[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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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