在不窃取焦点的情况下以批处理文件启动程序

Starting a program in batch file without stealing focus

我知道如何在 C++、C# 等中执行此操作,但我有一个简单的 BAT 文件,它对一个文件执行几个操作,在 Notepad++ 中打开它,然后继续处理下一个文件。因为我想等待它完成 运行ning 2 到 20 个文件,所以我希望它在后台 运行 直到它完成。

这是我在 Notepad++ 中打开文件的行:

start "" /b "C:\Program Files (x86)\Notepad++\notepad++.exe" "%filepath%"

是否可以 START 一个程序,使其 运行 不窃取焦点?

这不是一个通用的解决方案,但根据您的特定要求 (notepad++),您可以尝试 notepad++.exe -systemtray
的命令行选项 from notepad cmd line spec:

-systemtray
Start Notepad++ minimised in the system tray, aka notification area

(有一个选项可以启动缩小的程序 start /min,但 n++ 不支持它……不过它可以与普通记事本一起使用)