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
  • 16,827
  • 3
  • 36
  • 61
Gali
  • 13,941
  • 26
  • 79
  • 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
  • 837,282
  • 173
  • 1,862
  • 1,933
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,627
  • 8
  • 65
  • 136
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,247
  • 2
  • 20
  • 40