windows - Bat 文件位于所有窗口顶部

标签 windows batch-file

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

我无法在网上找到任何有关此问题的信息,因此我们将不胜感激。

最佳答案

我能提供的最好的就是来自 WScript.ShellappActivate 方法。这将需要 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/

相关文章:

c++ - 即使使用 FILE_FLAG_OVERLAPPED,Windows WriteFile 也会阻塞

c# - 如果我无法访问源代码,如何为 EXE 编写 GUI 包装器?

batch-file - 批处理文件夹和文本文件创建

batch-file - 批处理 - 搜索变量是否包含空格

windows - 在我的应用程序退出前将终止的线程上调用 CoUninitialize 是否重要?

windows - 我可以使用 C++ 获取 Windows 的原始安装日期吗?

windows - 如何安排任务在关闭窗口时运行

c++ - 在 QtCreator 3.6 中运行两个应用程序

java - 如何使用批处理文件运行两个java应用程序?

windows - 检查是否在不使用命令扩展且不使用批处理文件的情况下定义了环境变量?