我正在寻找一个命令,它始终将命令提示符保持在所有其他窗口之上,以便我的批处理脚本始终可见,无论打开了多少个其他窗口。
我无法在网上找到任何有关此问题的信息,因此我们将不胜感激。
最佳答案
我能提供的最好的就是来自 WScript.Shell
的 appActivate
方法。这将需要 jscript 或 vbscript。这是一个批处理/jscript 混合的示例。您可以测试它是否有效。您可以将 appActivate 放入循环中,以确保 will 窗口位于顶部:
@if (@X)==(@Y) @end /* JScript comment
@echo off
rem title is needed so the appActivate to be able to recognize the current shell
title ###
rem waiting so we'll have time to switch the windows
ping 192.0.2.1 -n 1 -w 10000 >nul 2>nul
rem the jscript part with the appActivate is called
cscript //E:JScript //nologo "%~f0" %*
rem checking the result
echo are we on top?
pause
exit /b %errorlevel%
@if (@X)==(@Y) @end JScript comment */
var sh=new ActiveXObject("WScript.Shell");
WScript.Echo(sh.AppActivate("###"));
关于windows - Bat 文件位于所有窗口顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30036077/