我已经设置了使用Windows调度程序每分钟运行的控制台应用程序。但是,当计划任务运行时,CMD屏幕会简短弹出。这很烦人,我希望任务在最小化然后关闭时启动。
研究现有资源,我尝试了:
1("运行用户是否已登录":什么都没有发生,我看不到文件中的任何条目,如果执行成功。
2(从.exe创建一个快捷方式,并使快捷方式运行最小化:快捷方式转换为实际应用,并最大程度地运行。
如果将控制台应用程序编译为 Windows Application
,它将全部隐藏cmd
窗口。
如果使用Visual Studio,请右键单击项目 -> properties -> 应用程序 -> 输出类型: -> Windows应用程序
对于入门者,如果您正在运行控制台应用程序,请在命令提示中运行start /?
。尝试/min
选项以查看是否有帮助。
C:Usershelp.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.