-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
executable file
·38 lines (33 loc) · 933 Bytes
/
Copy pathProgram.cs
File metadata and controls
executable file
·38 lines (33 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Diagnostics;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine(RunCommand());
}
public static bool RunCommand()
{
try
{
var procStartInfo = new ProcessStartInfo("cal")
{
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = false
};
var proc = new Process { StartInfo = procStartInfo };
proc.Start();
// Get the output into a string
var output = proc.StandardOutput.ReadToEnd();
return proc.ExitCode == decimal.Zero ? true : false;
}
finally
{
// do something
}
}
}
}