没有来自psexec的.NET控制台应用程序的输出

时间:2021-12-23 01:14:40

I'm having a very strange problem where I run a managed .net console app on a remote server using psexec. I get this error "The process tried to write to a nonexistent pipe".

我有一个非常奇怪的问题,我使用psexec在远程服务器上运行托管.net控制台应用程序。我收到此错误“进程尝试写入不存在的管道”。

Now I wrote an unmanaged C++ program to output to std::cout, and it works just fine.

现在我写了一个非托管的C ++程序输出到std :: cout,它工作得很好。

Interestingly, if I run cmd.exe remotely, and use the /u (unicode) option, I don't get the error, but I get garbage text streamed back to the console.

有趣的是,如果我远程运行cmd.exe,并使用/ u(unicode)选项,我不会收到错误,但我将垃圾文本流回控制台。

Can anyone explain what might be going on here?

任何人都可以解释这里可能发生的事情吗?

Cheers, Mark

1 个解决方案

#1


To work around this problem, I remotely run a .cmd script, which runs the .net application, redirecting (">") its output to a file. I then "type" the file in the script, and I now get output back.

要解决此问题,我远程运行.cmd脚本,该脚本运行.net应用程序,将其输出重定向(“>”)到文件。然后我在脚本中“键入”文件,现在我得到输出。

I still don't understand why the .net application's console output is getting lost, but this work-around does the job.

我仍然不明白为什么.net应用程序的控制台输出会丢失,但这种解决方法可以完成这项任务。

Mark

#1


To work around this problem, I remotely run a .cmd script, which runs the .net application, redirecting (">") its output to a file. I then "type" the file in the script, and I now get output back.

要解决此问题,我远程运行.cmd脚本,该脚本运行.net应用程序,将其输出重定向(“>”)到文件。然后我在脚本中“键入”文件,现在我得到输出。

I still don't understand why the .net application's console output is getting lost, but this work-around does the job.

我仍然不明白为什么.net应用程序的控制台输出会丢失,但这种解决方法可以完成这项任务。

Mark