i want to change position of batch file window. how?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

i want to change position of batch file window. how?

#1 Post by Mohammad_Dos » 10 Feb 2012 16:38

i want to change position of batch file window. how?

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: i want to change position of batch file window. how?

#2 Post by Ed Dyreen » 10 Feb 2012 16:43


Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

Re: i want to change position of batch file window. how?

#3 Post by Mohammad_Dos » 11 Feb 2012 02:20

is it possible without installing any app?

Judago
Posts: 15
Joined: 04 Nov 2011 07:59

Re: i want to change position of batch file window. how?

#4 Post by Judago » 11 Feb 2012 03:10

At invocation it's sort of possible. It's not a good solution....

Code: Select all

@echo off
set title=somewindowtitle
set xpos=150
set ypos=150
set /a "pos=(ypos << 16) + xpos"
if not "%~1"=="%title%" (
    >nul reg add "hkcu\console\%title%" /v WindowPosition /t REG_DWORD /d "%pos%" /f
    start "%title%" cmd /c "%~f0 %title%"
    goto :eof
)

reg delete "hkcu\console\%title%"
pause

Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

Re: i want to change position of batch file window. how?

#5 Post by Mohammad_Dos » 11 Feb 2012 07:34

it did not work for me :cry:

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: i want to change position of batch file window. how?

#6 Post by foxidrive » 11 Feb 2012 08:05

Mohammad_Dos wrote:it did not work for me :cry:


Try this. Maybe it is simpler to follow.

It creates file.bat that shows hello world.


Run the batchfile with "remove" as %1 to restore the registry setting to how it was.


Code: Select all

@echo off
set title=My Dos Window

if /i "%~1"=="remove" (
reg delete "hkcu\console\%title%"
goto :EOF
)

set xpos=150
set ypos=150
set /a "pos=(ypos << 16) + xpos"
>nul reg add "hkcu\console\%title%" /v WindowPosition /t REG_DWORD /d "%pos%" /f



 >file.bat echo.@echo off
>>file.bat echo.echo Hello World
>>file.bat echo pause

start "%title%" cmd /c "file.bat"

Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

Re: i want to change position of batch file window. how?

#7 Post by Mohammad_Dos » 11 Feb 2012 10:05

thank u. worked

is not exists any way to change position of the same batch file witch is already running?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: i want to change position of batch file window. how?

#8 Post by foxidrive » 11 Feb 2012 23:21

If you explain why you need to do that then maybe there is a workaround.

For instance you can change the default properties of cmd or just the batch file you are running, to open at a particular location with a certain font size, colour etc etc.
Right click on the title bar to change those properties.

storm97
Posts: 7
Joined: 13 Feb 2012 17:33

Re: i want to change position of batch file window. how?

#9 Post by storm97 » 15 Feb 2012 17:12

had a similar ?, can u make it full screen?

Mister Fox
Posts: 7
Joined: 20 Feb 2012 08:14
Location: Behind you
Contact:

Re: i want to change position of batch file window. how?

#10 Post by Mister Fox » 20 Feb 2012 08:27

storm97 wrote:had a similar ?, can u make it full screen?




On windows 7, the full-screen option for batch/cms windows is not present in the registry, and is therefore impossible to do.

On vista and below, pressing alt+enter will make the cmd window full screen.

Post Reply