【发布时间】:2017-08-10 16:47:46
【问题描述】:
有没有办法通过 rdp 运行本地程序 类似的东西:
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.FileName = @"G:\PSTools\PsExec.exe";
p.StartInfo.Arguments = @"\\tsclient calc.exe";
p.Start();
string output = p.StandardOutput.ReadToEnd();
string errormessage = p.StandardError.ReadToEnd();
p.WaitForExit();
在这种情况下,我得到了:
句柄无效。正在连接 tsclient...无法访问 tsclient
谢谢
【问题讨论】:
-
请更具体地说明您想要做什么。现在我将其理解为“我想从本地机器上的远程机器运行程序”。你确定这是你想说的吗?
-
你试图在远程机器上运行一些东西,那么为什么要通过 RDP 呢? psexec 正是为您做这件事。如果“tsclient”是您的远程计算机的名称,那么这将起作用。还要删除 cmd.exe,直接调用 calc.exe(或任何你想要的程序),否则它将不起作用。也许您需要 .exe 的完整路径名
标签: c#