所有窗口顶部的Bat文件

时间:2021-04-06 02:06:17

I'm looking for a command that will always keep the command prompt on top of all other windows so that my batch script will always be visible, no matter how many other windows are opened.

我正在寻找一个命令,它始终将命令提示符保存在所有其他窗口之上,这样无论打开多少其他窗口,我的批处理脚本始终都是可见的。

I have not been able to find any information on this anywhere online, so any help would be greatly appreciated.

我无法在网上任何地方找到任何相关信息,所以任何帮助将不胜感激。

1 个解决方案

#1


The best I can offer is appActivate method from WScript.Shell. this will require jscript or vbscript.Here's an example with batch/jscript hybrid.You can test if it works.You can put the appActivate in loop to be sure the will window will get on top:

我能提供的最好的是来自WScript.Shell的appActivate方法。这将需要jscript或vbscript.Here是batch / jscript hybrid的一个例子。你可以测试它是否有效。你可以把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("###"));  

#1


The best I can offer is appActivate method from WScript.Shell. this will require jscript or vbscript.Here's an example with batch/jscript hybrid.You can test if it works.You can put the appActivate in loop to be sure the will window will get on top:

我能提供的最好的是来自WScript.Shell的appActivate方法。这将需要jscript或vbscript.Here是batch / jscript hybrid的一个例子。你可以测试它是否有效。你可以把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("###"));