How to get command-line paramter at start

  • Thread starter Thread starter Felix Joachim
  • Start date Start date
F

Felix Joachim

Hi,

I have a simple application which I want to pass a string like this:
app.exe -parameter

What would be the easiest way read the parameter?
So far I've tried static void Main(string[] args) which didn't seem to work...

bye,
felix
 
Felix,

static void Main(string [] argv) should work for you.
Did you get an error or what?
 
I don't get any errors, on the other hand nothing happens if I start the
program thorugh a shortcut with a -param parameter too.

felix


Sergey said:
Felix,

static void Main(string [] argv) should work for you.
Did you get an error or what?

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Felix said:
Hi,

I have a simple application which I want to pass a string like this:
app.exe -parameter

What would be the easiest way read the parameter?
So far I've tried static void Main(string[] args) which didn't seem to
work...

bye,
felix
 
So, in the debugger, with the command line for debugging set to something
that you'll recognize, what do you see when main() runs?

Paul T.

Felix Joachim said:
I don't get any errors, on the other hand nothing happens if I start the
program thorugh a shortcut with a -param parameter too.

felix


Sergey said:
Felix,

static void Main(string [] argv) should work for you.
Did you get an error or what?

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Felix said:
Hi,

I have a simple application which I want to pass a string like this:
app.exe -parameter

What would be the easiest way read the parameter?
So far I've tried static void Main(string[] args) which didn't seem to
work...

bye,
felix
 
Ok, I actually had to look up how you can pass arguments to the debugged program.
http://www.geekpedia.com/Question30...hile-debugging-within-Visual-Studio-.NET.html

Then I quickly found out which stupid error I had made...

Thanks for your help.

bye,
felix

So, in the debugger, with the command line for debugging set to something
that you'll recognize, what do you see when main() runs?

Paul T.

Felix Joachim said:
I don't get any errors, on the other hand nothing happens if I start the
program thorugh a shortcut with a -param parameter too.

felix


Sergey said:
Felix,

static void Main(string [] argv) should work for you.
Did you get an error or what?

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Felix Joachim wrote:
Hi,

I have a simple application which I want to pass a string like this:
app.exe -parameter

What would be the easiest way read the parameter?
So far I've tried static void Main(string[] args) which didn't seem to
work...

bye,
felix
 
Back
Top