Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

Let's say:

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

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) 

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

Thank you for your time!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

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 is also available if you wish.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...