在Windows中安排时,控制台应用程序未启动进程 [英] Console application not starting processes when scheduled in Windows

查看:78
本文介绍了在Windows中安排时,控制台应用程序未启动进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中有一个简单的.NET控制台应用程序,它运行外部进程 pscp(putty安全副本)。

I have a simple .NET console app in C#, that runs an external process "pscp" (putty secure copy). This works great when I just run the .exe.

但是,当我在Windows计划任务中计划应用程序时,该应用程序似乎未打开外部进程pscp。可执行程序。通常,它应该弹出一个额外的控制台屏幕,并在那里打开pscp.exe。

However, when I schedule the application in windows scheduled tasks, the application does not seem to open the external process pscp.exe. Normally it should pop up an extra console screen and open pscp.exe there. This works, just not when scheduled.

我像这样启动过程:

pscp.FileName = "pscp.exe";
Process p = Process.Start(pscp);
p.WaitForExit();

关于如何解决此问题的任何想法?

Any ideas on how to fix this?

推荐答案

以/ c参数开头的cmd在新的cmd窗口中运行您的exe。

Starting cmd with the /c argument runs "your exe" in a new cmd window.

这篇关于在Windows中安排时,控制台应用程序未启动进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆