Reputation: 21
I would like to know how to start a batch file minimized without creating a shortcut.
I also want the code on how to relaunch a batch file minimized without using a VBS
So if anyone knows how to start the batch file minimized from the first launch that would be great.
Upvotes: 2
Views: 2761
Reputation:
By adding some powershell
@echo off
echo This batch will minimize and return to normal in 5 second intervals.
timeout /t 5 >nul
powershell -window minimized -command ""
timeout /t 5 >nul
powershell -window normal -command ""
echo and We're back..
if you want to use nothing other than batch, then the wrong way, as we do not really start
batch files, would be:
start "" /min "batchfilename.cmd"
If you run this from another batch file, that batch file will remain open, unless you exit it. So in order to run it in your actual batch file, it would be something like:
echo Hello!
if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~0" %* && exit
timeout /t 10
exit
The timeout here just gives you some time to see the window running minimized.
Upvotes: 1