本文介绍了批处理 - 运行循环命令时最小化窗口(不开始最小化)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法在运行某个命令后最小化批处理窗口.我已经知道 start/min 和启动窗口最小化的技巧,但是当它运行循环或超时时呢?

I'm wondering if there is a way to minimize a batch window after it runs a certain command. I already know start /min and tricks to START the window minimized but what about while it's running a loop or timeout?

让我们说:

echo Hello!
timeout /t 100
:COMMAND TO MINIMIZE WINDOW WHILE TIMEOUT IS RUNNING

现在我正在 bat 文件中调用一个 autoit 脚本以在命令运行时隐藏窗口:

Right now i'm calling an autoit script in the bat file to hide the window while the command is running with :

WinSetState($application_name, "", @SW_HIDE)

但我正在寻找可以直接在 .bat 文件中编码的纯批处理/powershell/vbs 解决方案.

but i'm looking for a pure batch/powershell/vbs solution that can be coded directly in the .bat file.

感谢您的宝贵时间!

推荐答案

使用 PowerShell 的调用选项,不执行命令或脚本.

Use PowerShell's invocation options, executing no command or script.

@echo off & setlocal

echo Hello!
powershell -window minimized -command ""
timeout /t 100
powershell -window normal -command ""

FWIW,-window hidden 如果你愿意,也可以使用.

FWIW, -window hidden is also available if you wish.

这篇关于批处理 - 运行循环命令时最小化窗口(不开始最小化)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 15:58
查看更多