I have an application which start in 0x0 position of my desktop. I want to open it in center of my desktop. I do not want to open it and use a move command to move it into center, just want my app to start immediately in center position.
Is there any way to do this via command prompt? Any other way?
This can be done by holding the Shift key and right-clicking the program's taskbar icon. Select Move from the menu that appears, and begin pressing the arrow keys to force the window to move position.
If you just open the batch file, click on the window, and then click "properties", and then to "layout", and scroll down to "Window Size", you can edit it from there.
You'll need an additional utility such as cmdow.exe to accomplish this. Look specifically at the /mov
switch. You can either launch your program from cmdow
or run it separately and then invoke cmdow
to move/resize it as desired.
Have found that AutoHotKey is very good for window positioning tasks.
Here is an example script. Call it notepad.ahk and then run it from the command line or double click on it.
Run, notepad.exe WinWait, ahk_class Notepad WinActivate WinMove A,, 10, 10, A_ScreenWidth-20, A_ScreenHeight-20
It will start an application (notepad) and then adjust the window size so that it is centered in the window with a 10 pixel border on all sides.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With