本文介绍了c#获取远程PsExec netstat命令的输出。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要编写一个返回netstat输出的程序。
我把PsExec.exe放在另一台机器上。
没有perrmission问题。
Hi, I'm tring to code a program that returns netstat output.
I put a PsExec.exe on the other machine.
There are no perrmission issues.
Process netStat = new Process();
netStat.StartInfo.UseShellExecute = false;
netStat.StartInfo.CreateNoWindow = true;
netStat.StartInfo.FileName = @"cmd.exe";
netStat.StartInfo.Arguments = @"\\10.190.167.200\r10\SilentInstall\Tools\PsExec.exe netstat";
netStat.StartInfo.RedirectStandardOutput = true;
netStat.Start();
string output = netStat.StandardOutput.ReadToEnd();
即使我看到命令运行netstat,输出返回
任何想法?
谢谢,Imbaro
even that i see the command run the netstat, the output returns ""
Any ideas?
Thanks, Imbaro
推荐答案
Process netStat = new Process();
netStat.StartInfo.UseShellExecute = false;
netStat.StartInfo.CreateNoWindow = true;
netStat.StartInfo.FileName = @"cmd.exe";
// netStat.StartInfo.Arguments = @"C/ \\10.190.167.200\r10\SilentInstall\Tools\PsExec.exe netstat";
netStat.StartInfo.Arguments = @"/C dir";
netStat.StartInfo.RedirectStandardOutput = true;
netStat.Start();
string output = netStat.StandardOutput.ReadToEnd();
这篇关于c#获取远程PsExec netstat命令的输出。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!