I'm running windows 2012 and whenever I type this in console:
start /min calc.exe
It opens the application but, it's not minimized to taskbar.
On Windonws 8.1 it actually does minimize it.
Any ideas why?
Edit: I want to be specific about this question as it is getting confused.
calc.exe above was just an example to demonstrate that /min switch is not working.
My real goal is to launch python and chrome minimized in Win 2012 R2 via command line.
Both of them do launch minimized in 8.1 when using the /min switch.
start /min file.exe
usesCreateProcess
API call to start the process, with the adecuated information inside theSTARTUPINFO
structure pointed by thelpStartupInfo
argument.Inside this structure, there is a
wShowWindow
member to indicate how to show the window of the started process. Its documentation statesThat is, you depend on how the started process handles its window management. There is nothing you could do in the
start
command to ensure the new window will be minimized.note:
start
command usesCreateProcess
in the case of executable files, but different arguments (a document, a URL, ...) lead to different APIs used (Ex.ShellExecute
orShellExecuteEx
), but you end in the same problem after following a different path.note 2: As already commented, in some cases (my case, windows 10,
calc.exe
) you start a process and it starts another one. You have not control on the second started process.I could not do this in Command Prompt but was able to do this in PowerShell. Since you are on 2012, install the Powershell ISE from Server Manager | Manage | Add roles and features.
First I created the function from this page Set Window Style function
Then I wrote these lines (Python may be named differently on your computer)
Finally, I saved this as a script and pasted it on the desktop.
You didn't wrote, that you don't want to use any tools, so here is one, that could solve your problem. No need to install, it is from a trusted distributor (Nirsoft), so you should give it a try. Link: http://www.nirsoft.net/utils/advanced_run.html
First you have to create a config file via gui, than you can start the probram by calling AdvancedRun.exe /run config.cfg
Hope it helps you!