1

I am trying to find a way to adjust the window that opens while you are running a batch file WITHOUT using 3rd party programs. I have adjusted the size and color of it, but would like to move the window to the top left corner of the screen. This also has to be self contained in the batch file it self(not right-clicking on title bar and changing the settings of window position that way).

So for example, I have a batch file that opens, you answer the questions it asks then it opens the required program to finish the tasks(such as logging you into putty). But then, I would like the batch window to move to top left(already adjusted size and color to make it more noticeable) so it's easier for the user to click on it to see the "codes" I added to it to use in putty.

This is going to be distributed to multiple users and we can't add 3rd party programs and I don't want to have to explain to everyone how to adjust how the window opens, I just want it to always open top left(no matter how the computers are set up).

Lastly, all PCs are running Windows 7 and thanks in advance for the help!

  • 1
    This is one of only two scenarios where I will ever recommend using PowerShell on a question with the [batch-file] tag. (PowerShell comes installed with Windows 7 so it's technically not third-party software.) – SomethingDark Dec 11 '15 at 23:54
  • 1
    See [Set The Window Position of an application via command line](http://stackoverflow.com/questions/7977322/) and [what's the difference between command prompt and cmd?](http://stackoverflow.com/questions/34068830/) There is no native Windows command line command to define size, position, font size, etc. of the console window once the batch file processing was started in a console window. Well, you could write a batch file which adds the appropriate settings to `HKCU\Console` for a console window with a specific title and then start a batch file in a new console window with this title. – Mofi Dec 12 '15 at 10:47

1 Answers1

0

Run the batch file from Start-Run:

set title=COMMAND PROMPT
reg add "hkcu\console\%title%" /v WindowPosition /t REG_DWORD /d "0" /f
start "%title%" cmd "%~f0 %title%"
exit /b 
somebadhat
  • 744
  • 1
  • 5
  • 17