Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I have an application that automates downloads. Sometimes, i want it to download the entire set of available downloads. Sometimes, though, i only want it to download a specific subset. I was thinking about using some sort of command line paremeter with the application to do this. can anyone tell me how to accomplish this in VB .NET?
  • *Experts*
Posted

To get the command line parameters passed into your application use those:

System.Environment.CommandLine() 'returns all params
'or
System.Environment.GetCommandLineArgs() 'returns params separated

  • *Experts*
Posted
First one will return the exe path and all the parameters. The second one will return an array of strings, that were created by separating every commend by a space. The first member of that array will be your exe path and name, and next members will hold the params.
  • *Experts*
Posted
You can start another program from a .NET application, you can do that using System.Diagnostics.Process. Command Line wont start anything for you by itself, you have to read the parameters and do whatever you do for each one.
Posted

So i start "program.exe 1", and somewhere in the program, i say

 

Dim arguments As [string]() = Environment.GetCommandLineArgs()

 

so....

 

Arguments[0] = 'program.exe'

Arguments[1] = '1'

 

have i got the basic idea?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...