command line trick

I just figured out a command line trick for windows that i couldn't find online and thought i would put it here so i would remember


to maximize or minimize a window from the command line

you can use the start command. It ushally is used to run a specified program or command but if there is no match on any extension, then looks to see if the name, without any extension, matches a directory name and if it does, the START command launches the Explorer on that path.

and it includes /min and /max switches to run the window minimized or maximized... see where this is going?

at a command prompt


START C:

will open a explorer window containing the contents of the C: drive

or bring forward the first created of any existing explorer window/s containing C:



START /MIN C:
will open and then minimize a explorer window containing the contents of the C: drive

or bring forward and then minimize the first created of any existing explorer window/s containing C:



START /MAX C:
will open and then maximize a explorer window containing the contents of the C: drive

or bring forward and then maximize the first created of any existing explorer window/s containing C:



so if theres a window open and its path is C:/windows

you can type start /min C:/windows at a prompt to minimize it

simply switch out /max for /min if you wanna maximize it.



additonally i should note if your path contains spaces your going to need to surround it in quotes so you have to enter anything for a "title" switch so the command dosn't get confused and think the path is a title you do it like this:

if theres a window open and its path is C:/Program Files

you can type start /max "title" "C:/Program Files"

or even just start /max "" "C:/Program Files" at a prompt to maximize it

simply switch out /min for /max if you wanna maximize it.



i found this really usefull for use in a batch file.

for original usage syntax and additonal info see http://www.robvanderwoude.com/start.html