954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Command Line Arguments

How can these be done. For example running a shourtcut thats path is this

C:\app.exe -sync

will run a certain part of the application(the sync function). Do i need to make a seperate application. Also say i have a program that plays music files. then i have a music file that i right click and select to open with ,my proggie. How could i make it so that it knows to play that file?

i hope thats clear. The main thing i would like to know is the command line arguments.

-T

tayspen
<Insert title here>
Team Colleague
1,622 posts since Jul 2005
Reputation Points: 84
Solved Threads: 99
 

Try the Environment.GetCommandLineArgs() method

_r0ckbaer
Light Poster
45 posts since Dec 2005
Reputation Points: 13
Solved Threads: 7
 
Try the Environment.GetCommandLineArgs() method

Ok, thanks i check it out.

-T

tayspen
<Insert title here>
Team Colleague
1,622 posts since Jul 2005
Reputation Points: 84
Solved Threads: 99
 

static void Main(string[] args)
{
}

make your Main look like this and "args" is a string array of all the args passed

plazmo
Posting Whiz in Training
207 posts since Aug 2005
Reputation Points: 23
Solved Threads: 16
 

static void Main(string[] args) { }

make your Main look like this and "args" is a string array of all the args passed

Hey, thanks ive searched the web and ound some examples...and i will continue to mess around with it.

-T

tayspen
<Insert title here>
Team Colleague
1,622 posts since Jul 2005
Reputation Points: 84
Solved Threads: 99
 

C# program accept arguments in the order of args[0], args[1] etc.

Console.WriteLine("Arguments-1 " + args[0]+" Argument-2 "+args[1]);

read full source code
http://csharp.net-informations.com/overview/csharp-commandline-tools.htm

chan.

chan_lemo
Newbie Poster
17 posts since Oct 2008
Reputation Points: 10
Solved Threads: 1
 

What is commandline argument with example ?

sandeep9808
Newbie Poster
1 post since May 2010
Reputation Points: 9
Solved Threads: 0
 

Welcome sandeep9808.

Please do not resurrect old threads. If you have any questions please ask. .... You are welcome to start your own threads.

Please read the rules before posting again - http://www.daniweb.com/forums/thread78223.html and rules .

Thread Closed.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You