c# 实现操作系统 “运行” 功能
void Main() { var psi = new ProcessStartInfo(); psi.FileName = "cmd.exe"; psi.Arguments = "/c start /ABOVENORMAL notepad \"c:\\abc.txt\""; psi.CreateNoWindow = true; psi.UseShellExecute = false; psi.RedirectStandardOutput = true; Process.Start(psi); }
如果要隐藏的运行则用以下代码:
var cmd = "taskkill /pid 62084"; var psi = new ProcessStartInfo(); psi.FileName = "cmd.exe"; psi.Arguments = "/c start /B " + cmd; psi.CreateNoWindow = true; psi.UseShellExecute = false; psi.RedirectStandardOutput = true; Process.Start(psi);
桂棹兮兰桨,击空明兮溯流光。