This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.ProcessorAffinity = new IntPtr(0x0001); // Set affinity to the first processor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.PriorityClass = ProcessPriorityClass.High; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StreamWriter inputWriter = process.StandardInput; | |
inputWriter.WriteLine("Some input data"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StreamReader outputReader = process.StandardOutput; // Or use process.StandardError to read the error output | |
string line; | |
while ((line = outputReader.ReadLine()) != null) | |
{ | |
Console.WriteLine(line); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startInfo.RedirectStandardInput = true; | |
startInfo.RedirectStandardOutput = true; | |
startInfo.RedirectStandardError = true; | |
startInfo.UseShellExecute = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To gracefully close a process, call the Close() method: | |
process.Close(); | |
// OR: To forcefully terminate a process, call the Kill() method: | |
process.Kill(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.WaitForExit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startInfo.UserName = "username"; | |
startInfo.Password = new SecureString(); | |
startInfo.Domain = "domain"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startInfo.Arguments = "/k ipconfig"; | |
startInfo.WorkingDirectory = @"C:\"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.Start(); |
NewerOlder