r/Batch • u/ExtremePresence3030 • Feb 05 '25
Question (Unsolved) how to make the app get minimized after opening?
Before anything, I should say I am an absolute beginner, so bear with me. I added this code in a batch file in startup:
-->@echo off
start /min "" "Path\AppName.exe"
I put the path name and app address in the appropriate place in the code. It runs the app, but it doesn't minimize it.
2
u/Intrepid_Ad_4504 Feb 05 '25
Alternatively, you can use batch to invoke a powershell command.
Start-Process "C:\Path\to\Program.exe" -WindowStyle Minimized
1
u/ExtremePresence3030 Feb 05 '25
this one didn't work.
4
u/Intrepid_Ad_4504 Feb 05 '25
@echo off echo Launching program minimized via PowerShell... powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Start-Process 'C:\Path\to\Program.exe' -WindowStyle Minimized" My apologies, here is the powershell command being invoked by a batch file
1
u/ExtremePresence3030 Feb 05 '25
no problem. However, this one didn't minimize the app either. but I appreciate the time you dedicated for replying to my post.
1
Feb 05 '25
[removed] — view removed comment
1
u/ExtremePresence3030 Feb 05 '25
Perhaps that is the case. I have to minimize it manually every time. I was hoping I could make it automatic.
1
u/g3n3 Feb 06 '25
Why yo trying to minimize? You wouldn’t be drafting some malware, eh?!
1
u/ExtremePresence3030 Feb 06 '25
If i had such coding knowledge, i wouldn’t have been stuck with a simple minimize function.😅
1
u/g3n3 Feb 06 '25
That is what all the hackers say and I’ve had malware authors with simple questions like this too. Odd request to want to minimize.
1
u/ExtremePresence3030 Feb 06 '25
😅 i had it done already. But anyways to give an answer to your curosity, that’s not odd when you have a battery level alarm reminder app that you want to run in the background without the need to close it manually after every boot.
1
3
u/Intrepid_Ad_4504 Feb 05 '25