我正在使用这段代码在远程机器上打开进程:
Process process = new Process();
ProcessStartInfo psi = new ProcessStartInfo(@"D:\tools\PsExec\PsExec.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.RedirectStandardInput = true;
psi.WindowStyle = ProcessWindowStyle.Minimized;
psi.CreateNoWindow = true;
psi.Arguments = "\\\\192.168.0.100 -u user-p pass D:\\app.exe";
process.StartInfo = psi;
process.Start();
在远程机器上我可以看到进程开始但我看不到我的应用程序 GUI
。
双击exe会打开GUI
最佳答案
尝试使用 psexec.exe
和 -i
开关:
psi.Arguments = "\\\\192.168.0.100 -i -u user -p pass D:\\app.exe";
或
psi.Arguments = "\\\\192.168.0.100 -i 0 -u user -p pass D:\\app.exe";
如果您使用的是 vista 或更高版本,请使用 1 而不是 0。用户桌面在 vista 或更高版本的 session 1 中运行。
关于c# - PsExec 打开我的远程机器进程但应用程序没有启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19633218/