c# 启动时隐藏窗口闪烁_在启动时隐藏闪烁的命令行和批处理文件Windows

c# 启动时隐藏窗口闪烁_在启动时隐藏闪烁的命令行和批处理文件Windows

c# 启动时隐藏窗口闪烁

I use a lot of batch files, command line applications, and even Ruby scripts (which run from the command line). One of the things that has always irritated me is the flashing command prompt window when I make a shortcut for a batch file, especially when I put it into the startup folder to run when I first login.

我使用许多批处理文件,命令行应用程序,甚至是Ruby脚本(从命令行运行)。 当我为批处理文件创建快捷方式时,尤其是当我将其放入启动文件夹以在首次登录时运行时,闪烁的命令提示符窗口一直是困扰我的一件事。

There’s a really useful utility that you can use called Hidden Start (hstart), which will start up a command line application hidden in the background, which eliminates the flashing window.

您可以使用一个非常有用的实用程序,称为“ 隐藏启动(hstart)” ,它将启动隐藏在后台的命令行应用程序,从而消除了闪烁的窗口。

If you launch the utility with no parameters, it will pop up the settings dialog.

如果不使用任何参数启动该实用程序,它将弹出设置对话框。

c# 启动时隐藏窗口闪烁_在启动时隐藏闪烁的命令行和批处理文件Windows

When using this utility, there are three key things to remember: Use the /NOWINDOW parameter to keep the window hidden, use the /D=path argument to make sure that the current directory is set correctly, and make sure to surround your application argument with quotes.

使用此实用程序时,需要记住三个关键事项:使用/ NOWINDOW参数使窗口保持隐藏状态,使用/ D = path参数以确保正确设置了当前目录,并确保围绕应用程序参数带引号。

For instance, if I had a batch file stored in c:\scripts\mybatch.bat, I would start it by using the following parameters in my shortcut:

例如,如果我有一个批处理文件存储在c:\ scripts \ mybatch.bat中,则可以通过在快捷方式中使用以下参数来启动它:

hstart /NOWINDOW /D=c:\scripts “c:\scripts\mybatch.bat”

hstart / NOWINDOW / D = c:\ scripts“ c:\ scripts \ mybatch.bat”

You’ll probably want to copy hstart.exe into somewhere in the system path, for instance C:\windows might work nicely.

您可能需要将hstart.exe复制到系统路径中的某个位置,例如C:\ windows可能工作良好。

Download Hidden Start (hstart)

下载隐藏启动(hstart)

翻译自: https://www.howtogeek.com/howto/windows/hide-flashing-command-line-and-batch-file-windows-on-startup/

c# 启动时隐藏窗口闪烁