Automated setup of DOS command window
Moderator: DosItHelp
Automated setup of DOS command window
Whenever I open a new DOS window, I have to do 3 things:
1. Set the font to Lucida Console, size 12
2. Set the Layout to: Buffer W/H=132/9999; Window W/H=132/75
3. Set the Edit Options to have QuickEdit checked and InsertMode unchecked.
I have set this up as my default for a new DOS window from the desktop, but I would like to do this from a BAT file, since using START creates a default window.
I have managed to accomplish item 2 above by:
:conSize.bat winWidth winHeight bufWidth bufHeight
mode con: cols=%1 lines=%2
powershell -command "&{$H=get-host;$W=$H.ui.rawui;$B=$W.buffersize;$B.width=%3;$B.height=%4;$W.buffersize=$B;}"
However I don't know how to do items 1 and 3. Any help appreciated.
1. Set the font to Lucida Console, size 12
2. Set the Layout to: Buffer W/H=132/9999; Window W/H=132/75
3. Set the Edit Options to have QuickEdit checked and InsertMode unchecked.
I have set this up as my default for a new DOS window from the desktop, but I would like to do this from a BAT file, since using START creates a default window.
I have managed to accomplish item 2 above by:
:conSize.bat winWidth winHeight bufWidth bufHeight
mode con: cols=%1 lines=%2
powershell -command "&{$H=get-host;$W=$H.ui.rawui;$B=$W.buffersize;$B.width=%3;$B.height=%4;$W.buffersize=$B;}"
However I don't know how to do items 1 and 3. Any help appreciated.
Re: Automated setup of DOS command window
acferrad wrote:Whenever I open a new DOS window, I have to do 3 things:
1. Set the font to Lucida Console, size 12
2. Set the Layout to: Buffer W/H=132/9999; Window W/H=132/75
3. Set the Edit Options to have QuickEdit checked and InsertMode unchecked.
I have set this up as my default for a new DOS window from the desktop, but I would like to do this from a BAT file, since using START creates a default window.
Why do you have to do that every time you open a cmd window, if you have saved that as default?
Re: Automated setup of DOS command window
Because I open up other DOS windows in my BAT files, using START. When you do this it knows nothing about your default icon on the desktop and its defaults. So it gives you the Windows default, the dinky 80/300/80/25 with 8x12 Raster font.
Re: Automated setup of DOS command window
The Start command opens the same default window with your properties, if you have saved the defaults.
Which version of Windows are you using?
Open a cmd window
Right click the title bar and select properties
change your settings
click ok.
That should save the properties for the cmd window.
Code: Select all
start cmd /k
Which version of Windows are you using?
Open a cmd window
Right click the title bar and select properties
change your settings
click ok.
That should save the properties for the cmd window.
Re: Automated setup of DOS command window
No you're missing the point. I don't open up the second DOS window, the first BAT file does.
To see this, open up a cmd window, this will have your default icon settings (change them to make them different from the Windows default). Now create a BAT file, say aa.bat containing:
start "new window"
Now run aa.bat. You will see that a new DOS window is created with the Windows default settings, not the one's of your first DOS window.
To see this, open up a cmd window, this will have your default icon settings (change them to make them different from the Windows default). Now create a BAT file, say aa.bat containing:
start "new window"
Now run aa.bat. You will see that a new DOS window is created with the Windows default settings, not the one's of your first DOS window.
Re: Automated setup of DOS command window
I know you are wrong, and to soothe your feelings I tested it.
It opens up a window with my changed cmd preferences.
If you are running security software like spybot and it's teatimer, or one of a number of AV packages that try to do too much - they block registry writes
that they consider unwise and the user has no way of knowing why stuff doesn't work properly.
That is a primary suspect to prevent your Windows from behaving normally.
It is also possible that you need to open a cmd window as admin (right click and open as admin) to change the settings, as UAC can affect this too.
It opens up a window with my changed cmd preferences.
If you are running security software like spybot and it's teatimer, or one of a number of AV packages that try to do too much - they block registry writes
that they consider unwise and the user has no way of knowing why stuff doesn't work properly.
That is a primary suspect to prevent your Windows from behaving normally.
It is also possible that you need to open a cmd window as admin (right click and open as admin) to change the settings, as UAC can affect this too.
Re: Automated setup of DOS command window
I know I am not wrong, see image below. Not sure how to embed images, let's try:
https://dl.dropboxusercontent.com/u/3783578/Snap3.jpg
I have no spybot or teatimer whatever that is. I tried the same thing on my work laptop, it did the same thing.
https://dl.dropboxusercontent.com/u/3783578/Snap3.jpg
I have no spybot or teatimer whatever that is. I tried the same thing on my work laptop, it did the same thing.
Re: Automated setup of DOS command window
BTW tried as Admin, same problem.
I don't know why the upload to dropbox is so slow, jpg is only 138k
hopefully be there soon
I don't know why the upload to dropbox is so slow, jpg is only 138k
hopefully be there soon
Re: Automated setup of DOS command window
I tested it in a Windows 7 VM and you were correct.
You need to change the defaults when you right click on the title bar of a cmd window.
Then start will open the saved defaults.
You need to change the defaults when you right click on the title bar of a cmd window.
Then start will open the saved defaults.
Re: Automated setup of DOS command window
Thank you. However this is what I want to do from code! I am tired of reconfiguring these STARTed windows manually. Hence my original question.
They only keep their settings sporadically. If I change the settings for the STARTed window and rerun aa.bat, it's OK. But if I change aa.bat to:
start "new window2"
it goes back to the old Windows settings.
They only keep their settings sporadically. If I change the settings for the STARTed window and rerun aa.bat, it's OK. But if I change aa.bat to:
start "new window2"
it goes back to the old Windows settings.
Re: Automated setup of DOS command window
I changed my defaults when I set up this version of windows, as I have done in Windows 98, Windows XP, Vista and Windows 7 in the past, and
they always open the window with your saved defaults (unless you roll back to before setting the default when using system restore).
The only misled advice I gave you was to change the properties, when you should be changing the defaults.
they always open the window with your saved defaults (unless you roll back to before setting the default when using system restore).
The only misled advice I gave you was to change the properties, when you should be changing the defaults.
Re: Automated setup of DOS command window
A tip is to change the defaults and then create a shortcut for cmd.
Changing the properties alters the shortcut settings, so you can indeed have two different cmd window looks.
If you change the defaults first, and then create a shortcut (if you use one) then both will have the same settings.
To change the look in the future, change the cmd defaults and then create a new shortcut again.
Changing the properties alters the shortcut settings, so you can indeed have two different cmd window looks.
If you change the defaults first, and then create a shortcut (if you use one) then both will have the same settings.
To change the look in the future, change the cmd defaults and then create a new shortcut again.
Re: Automated setup of DOS command window
I did all this but it does not work when you use START. But I have found a solution:
start cmd /k newbatchfile.bat
does keep the new default window settings, while:
start "window title" newbatchfile.bat
does not.
So if you want a title, use the title command in newbatchfile.bat
start cmd /k newbatchfile.bat
does keep the new default window settings, while:
start "window title" newbatchfile.bat
does not.
So if you want a title, use the title command in newbatchfile.bat
Re: Automated setup of DOS command window
@acferrad: If you would have tried what foxidrive has used, you would have found the solution earlier.foxidrive wrote:The Start command opens the same default window with your properties, if you have saved the defaults.Code: Select all
start cmd /k
But it is indeed a funny behaviour of start:
Code: Select all
start ""
start
penpen
Edit: Btw: As foxidrive has written, you could open a cmd window using 'start ""' (without the ' characters) and change its default properties (it is stored in the registry using the command shell title).
Last edited by penpen on 21 May 2014 13:36, edited 1 time in total.