0

i need to run program with command in Windows-CE or Windows-Mobile

for example: RunMe.exe true or RunMe.exe false

if the program returns true the program will do something and if the program returns false

the program will do something else.

how can I accomplish this ?

Brandon Frohbieter
  • 17,563
  • 3
  • 40
  • 62
Gali
  • 14,511
  • 28
  • 80
  • 105

3 Answers3

1

Your question is unclear.

If you want to write such a program, use the string[] args parameter to Main().
(Or call Environment.GetCommandLineArguments())

If you want to run such a program, call Process.Start.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
0

If you want to do this without writing another program, you can create a shortcut file to launch your application with the desired command-line options.

The format of a shortcut file looks like this:

[number of ASCII characters after pound sign allocated to command-line arguments]#[command line] [optional parameters]

For example:

40#\Windows\MyApp.exe parameter1 parameter2

see: http://msdn.microsoft.com/en-us/library/ms861519.aspx

PaulH
  • 7,759
  • 8
  • 66
  • 143
0

From this question (which got it from msdn):

// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "YOURBATCHFILE.bat";
p.Start();
// Do not wait for the child process to exit before
// reading to the end of its redirected stream.
// p.WaitForExit();
// Read the output stream first and then wait.
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
Community
  • 1
  • 1
DanTheMan
  • 3,277
  • 2
  • 21
  • 40