简体   繁体   English

最小化运行计划任务

[英]Run Scheduled Task Minimized

I have setup a console app to run every minute using Windows scheduler. 我已经设置了一个控制台应用程序,以使用Windows Scheduler每分钟运行一次。 However, a CMD screen pops-up briefly when the scheduled task runs. 但是,计划的任务运行时,会短暂弹出CMD屏幕。 This is kind of annoying and I would like the task to start up while minimized and then close. 这有点烦人,我希望任务在最小化的情况下启动,然后关闭。

Looking into existing resources, I have tried: 研究现有资源,我尝试过:

1) "Run whether user is logged on or not": nothing happens, I do not see any entry in the file which should happen if the execution was successful. 1)“无论用户是否登录都运行”:什么也没有发生,我看不到文件中的任何条目,如果执行成功,该条目应该发生。

2) Create a Shortcut from the .exe and make the shortcut run minimized: The shortcut is converted to actual app and it runs maximized. 2)从.exe创建快捷方式,并使该快捷方式的运行最小化:该快捷方式被转换为实际应用程序,并且其最大化运行。

If you compile the Console Application as a Windows Application it'll hide the cmd window all together. 如果将控制台应用程序编译为Windows Application它将一起隐藏cmd窗口。

If using Visual Studio, right click the project -> Properties -> Application -> Output type : -> Windows Application 如果使用Visual Studio,请右键单击项目-> 属性 -> 应用程序 -> 输出类型 :-> Windows应用程序

For starters try running start /? 对于初学者,请尝试运行start /? in command prompt if you are running a console app. 如果正在运行控制台应用程序,请在命令提示符下输入。 Try /min option to see if it helps. 尝试/min选项以查看是否有帮助。

C:\Users\help.me>start /?
Starts a separate window to run a specified program or command.

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
  [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
  [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B]
  [command/program] [parameters]

"title"     Title to display in window title bar.
path        Starting directory.
B           Start application without creating a new window. The
            application has ^C handling ignored. Unless the application
            enables ^C processing, ^Break is the only way to interrupt
            the application.
I           The new environment will be the original environment passed
            to the cmd.exe and not the current environment.
MIN         Start window minimized.
MAX         Start window maximized.
SEPARATE    Start 16-bit Windows program in separate memory space.
SHARED      Start 16-bit Windows program in shared memory space.
LOW         Start application in the IDLE priority class.
NORMAL      Start application in the NORMAL priority class.
HIGH        Start application in the HIGH priority class.
REALTIME    Start application in the REALTIME priority class.
ABOVENORMAL Start application in the ABOVENORMAL priority class.
BELOWNORMAL Start application in the BELOWNORMAL priority class.
NODE        Specifies the preferred Non-Uniform Memory Architecture (NUMA)
            node as a decimal integer.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM