好吧,我知道如何通过使用powershell方法最小化桌面上所有打开的窗口--MinimizeAll():
powershell -command "& { $x = New-Object -ComObject Shell.Application; $x.minimizeall() }"问题是:这种方法可以最大限度地减少包括当前cmd-console在内的一切,在我的情况下,用户始终可以看到它。
现在,要解决此问题,我使用外部nircmd.exe工具,我的.bat文件的这部分如下所示:
:: change current command prompt window title title my-cmd-console :: minimize all open windows on the desktop with powershell command powershell -command "& { $x = New-Object -ComObject Shell.Application; $x.minimizeall() }" :: bring console back to the front with nircmd.exe command 'win activate [filter window by title]' nircmd.exe win activate title "my-cmd-console"我不喜欢这段代码的是屏幕上有很多“闪烁”:开始时,控制台出现在桌面上,然后它与所有其他窗口一起被最小化,然后它再次被带回桌面前面。
所以,问题是:如何使控制台出现在桌面前面并“锁定”,以便在达到命令行EXIT之前它永远不会消失。
PS不确定,但也许有一个替代解决方案'最小化所有除了特定窗口'问题,而无需使用外部nircmd.exe工具。 有任何想法吗?
well, I know how to minimize all open windows on the desktop from a batch file by using powershell method - MinimizeAll():
powershell -command "& { $x = New-Object -ComObject Shell.Application; $x.minimizeall() }"the problem is: this method minimizes everything including current cmd-console which should be in my case always visible to the user.
now, to workaround this problem I use external nircmd.exe tool and this part of my .bat-file looks like this:
:: change current command prompt window title title my-cmd-console :: minimize all open windows on the desktop with powershell command powershell -command "& { $x = New-Object -ComObject Shell.Application; $x.minimizeall() }" :: bring console back to the front with nircmd.exe command 'win activate [filter window by title]' nircmd.exe win activate title "my-cmd-console"what I don't like about this code is that there is much 'flashing' on the screen: at start, the console appears on the desktop, then it gets minimized with all other windows and then it's brought back on the desktop front again.
so, the question is: how to make console appear on the desktop front and 'lock it', so that it never gets out of sight until the command line EXIT is reached.
P.S. not sure, but maybe there is an alternative solution to 'minimize all except for particular window' problem without need to use external nircmd.exe tool. any ideas?
最满意答案
最小化除活动窗口之外的所有窗口(切换命令):
nircmd sendkeypress rwin+homeminimize all but the active window (toggling command):
nircmd sendkeypress rwin+home更多推荐
发布评论