Windows cmd window size

How to Set Command Prompt Default Window Size and Position

When you open Command Prompt and position it on your preferred location on the screen, the setting is not retained. Also, when you resize the Command Prompt window and close it, the setting is not saved. This system managed positioning annoys many users who prefer uniformity in every aspect of the user interface. This post tells you how to customize the default Command Prompt window size (width & height) and set its default position in terms of screen coordinates.

You can customize a Command Prompt window’s appearance by changing its window size, position, font, and colors. You can save these settings independently for each Command Prompt shortcut so that you can have custom settings for different tasks. Also, you configure a global default window size, position, and font settings, which will apply when you launch Command Prompt window using other means — for example, when you run cmd.exe directly.

Set Command Prompt Default Window Size & Position for a Specific Shortcut

To customize a Command Prompt window size and position for a particular shortcut, use these steps:

  1. Right-click on the Command Prompt shortcut, and click Properties. Alternately, double-click the shortcut to launch Command Prompt. Right-click on the Command Prompt title bar and click Properties.
  2. Click on the Layout tab.
  3. Change the Window size and Window Position settings in that tab. As you alter the Width, Height, Left, and Top values, you can see the Window preview which will help you set the desired size and position.
    Note that you’ll need to first uncheck the Let system position window option setting to input custom values.
  4. Click OK. Changes made here affect all future Command Prompt sessions launched from that particular shortcut.

Set Command Prompt Global Default Window Size & Position

  1. Open a Command Prompt window by running cmd.exe from the Start Run dialog. In Windows 8 and Windows 10, you can right-click Start, and click Command Prompt.

Difference between “Properties” and “Defaults” options

Right-clicking on the Command Prompt window title offers access to the Properties dialog box. (If Command Prompt is running in full-screen mode, press Alt + Enter to switch to window display.) Changes you make here affect the current session, and all future sessions launched only from that shortcut. The changes made are saved inside that particular shortcut (.lnk) file, instead of the registry.

Right-clicking on the Command Prompt window title and choosing Defaults from the Control menu lets you make changes that will not affect the current session but instead will affect all future sessions (except for those launched from a shortcut whose properties have been customized). These changes also affect future sessions in character-mode, MS-DOS-based applications that do not have a Program Information File (PIF) and do not store their own settings. This setting is saved in the registry.

Registry Key

The global default settings are stored in the following per-user registry key. You can export the key to a .reg file and apply the settings to other systems.

Important: If you make any changes to the Command Prompt window that was opened it directly (via the Run dialog, as opposed to a desktop shortcut), the customized settings will be saved in the following registry key instead:

Читайте также:  Task host windows что это как удалить

The above key overrides the defaults in HKEY_CURRENT_USER\Console when you open Command Prompt directly (not from a shortcut.)

To reset to default settings, the subkey %SystemRoot%_system32_cmd.exe can be deleted.

Reset Command Prompt Settings to Windows Default

To reset Command Prompt preferences to defaults:

  • Please copy the above contents and paste it into Notepad.
  • Save the file with .reg extension (e.g., reset_cmd.reg .)
  • Double-click the .reg file to apply the settings.

The default colors, font face, font family, window size, position (system managed), and other settings are restored. As stated earlier, this is a per-user setting.

One small request: If you liked this post, please share this?

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

Microsoft → Windows → How to Set Command Prompt Default Window Size and Position

Задание размера, положения и цвета окна консоли

собственно, речь идет о том, как можно задать свойства окна, в котором будет выполняться bat скрипт, а именно: размеры и положение на экране?Ну и другие атрибуты тоже. Знаю, например, что заголовок окна меняется командой title, а цвет текста color.

Сохранение размера и положения окна
1. В функции CreateWindowEx есть параметры x, y, nWidth и nHeight. Как сделать, чтобы можно было.

Позиционирование размера/положения окна чужого процесса
Всем привет! Постоянно администрирую маленький сервер.. При загрузке сервера на рабочем столе.

ChangerSizeWindows Позиционирование размера / положения окна чужого процесса
Всем привет! Постоянно администрирую маленький сервер.. При загрузке сервера на рабочем столе.

Решение

retrospider
color /? — задаёт цвет текста и окна консоли
пример: color 17 белый текст на синем фоне.
mode /? — размеры
пример: mode con:cols=83 lines=36 ширина окна консоли=83 я так понимаю символов; высота=36 линий,строк

Решение

то потеряете буфер экрана (прокрутку) для текущего сеанса.

Сделать все желаемое сразу Вы можете через перезапуск консоли:

— Настроить консоль как Вам угодно согласно этой инструкции: Настройка интерфейса и эффективное использование CMD [Статья]
— открыть редактор реестра и экспортировать подраздел HKEY_CURRENT_USER\Console в файл Reg_Console_Custom.reg и поместить рядом с батником.
— поместить такой код с подпрограммой в Ваш основной батник:

Меню пользователя @ Eva Rosalene
Посетить домашнюю страницу Eva Rosalene

Интегрировал в ApplyTweak как ненужный костыль при очередном обновлении Virulogs 🙂

Цитата: » Кроме, того, если Вы воспользуетесь командой вида
Bash
mode con:cols=83 lines=36
то потеряете буфер экрана (прокрутку) для текущего сеанса. «

Ничего подобного: mode con:cols=83
и ваша прокрутка осталась, просто уберите в команде lines=36 и прокрутка останется

Заказываю контрольные, курсовые, дипломные и любые другие студенческие работы здесь или здесь.

Изменение размера окна консоли
_CONSOLE_SELECTION_INFO *console; GetConsoleSelectionInfo(console); .

Как в консоли вывести надпись по центру строки в зависимости от размера окна?
Чтобы всегда центровалось по центру, и без разницы какой размер окна задан у пользователя.

Как создавать окна со своими заголовками (другого цвета, меньшего размера, . ) ?
Всем привет, Кто знает, как создавать свои собственные окна в Windows? Я нашел в Интернете.

CMD window size

Every time I open cmd the window size is 20×5. The problem is that even though the default settings are set to 80×25, it doesn’t do anything and the properties need to be changed every time the cmd is opened.

The problem started after my PC has been infected and now every time I open windows, there is a command prompt after logging in and since then all other cmd windows open is the 20×5 size. I’ve checked the registry and the values are correct, although they don’t take effect.

Читайте также:  Backup windows with linux

2 Answers 2

The registry entry HKCU\Console mentioned by NeveraX isn’t the whole story, every .lnk file used to start cmd.exe can have different settings not so easy discovered.

For HKCU\Console I once upon a time wrote a batch to enumerate the window/buffer sizes used:

Sample shorted output:

EDIT I’d also check the Autorun egistry key

I know that it’s a necrothread but this solution can help someone in the future. GNU Octave refused to work properly without this fix. So I spent several hours searching the internet and almost end up restoring Windows to default settings.

I fixed this issue by applying a registry file that contained default values for the registry keys «HKEY_CURRENT_USER\Console» and «HKEY_CURRENT_USER\Software\Microsoft\Command Processor».

If it doesn’t help there are some other solutions on this site for Windows 7, 8, 8.1, 10.

Resize command prompt through commands

I want to resize the command prompt window in a batch file, is it possible to set a height and width through something I can just add in the batch file?

9 Answers 9

Modify cmd.exe properties using the command prompt Pretty much has what you’re asking for. More on the topic, mode con: cols=160 lines=78 should achieve what you want. Change 160 and 78 to your values.

The unit is the number of characters that fit in the command prompt, eg.

will make the command prompt 80 ASCII chars of width and 100 of height

That is the smallest size possible.

is the largest possible, although it probably won’t even fit your screen. If you want to minimize it, type

and of course, to maximaze,

I am currently working on doing this from the same batch files so that you don’t have to have two or start it with cmd. of course, there are shortcuts, but I’m gonna try to figure it out.

Most people will tell you to run this command:

but you should just try typing:

as a line in your batch file or cmd prompt.

You can use /start /max [your batch] it will fill the screen with the program it oppose to /min

If you want to run a .bat file in full screen, right click on the «example.bat» and click create shortcut, then right click on the shortcut and click properties, then click layout, in layout you can adjust your file to the screen manually, however you can only run it this way if you use the shortcut. You can also change font size by clicking font instead of layout, select lucida and adjust the font size then click apply

I know, that’s a 8 years old question, but that can still happen today.

Powershell ca be used for that. An example is shown here. The shortest command for the cmd is:

Set your wanted window size to the width and hight vars. However, this short line has two limitations:

  • Be sure that the window size is not larger than the predefined buffer sizes. Otherwise there occur an error message.
  • Depending on the system, loading and processing of Powershell takes 2. 4 seconds. Sometimes this is a long time to wait.

To avoid that, in the command below the buffer size is defined. In addition, the process runs parallel to the other following cmd commands:

The width and height values to the buffersize object, here 177 and 999, must be bigger or equal to the window size values.

Although the answers given here can be used to temporarily change window size, they don’t seem to affect font size (at least not on my PC). I have an alternative way. I don’t know if this what you’re looking for but if you want to make changes automatically/permanently to Console font/window size, you can always do a script that edits the registry:

Читайте также:  Телеграмм для linux mint

Those keys deal with the consoles that come up when your run a script or press shift and select «open command prompt here». The Command Prompt entry in your start menu does not use the registry to store it’s preferences but stores the prefs in the shortcut itself.

Windows command for file size only

Is there a Windows command that will output the size in bytes of a specified file like this?

I know that the dir command outputs this information, but it outputs other information also.

I could easily write such a program, but I would prefer to use a native Windows command if possible, or only what is available in a fresh install of Windows XP.

12 Answers 12

If you are inside a batch script, you can use argument variable tricks to get the filesize:

This gives results like the ones you suggest in your question.

at the command prompt for all of the crazy variable manipulation options. Also see this article for more information.

Edit: This only works in Windows 2000 and later

znI . – Patrick Cuff Jan 27 ’09 at 16:41

z variables refer specifically to a file passed as an argument, so will be looking up their values from the filesystem, rather than a dynamic stream of bytes. – Mike Houston Aug 5 ’16 at 17:39

zn1 wasn’t working in a console ( 1 != I xD) – kayleeFrye_onDeck Oct 15 ’19 at 21:16

If you don’t want to do this in a batch script, you can do this from the command line like this:

Ugly, but it works. You can also pass in a file mask to get a listing for more than one file:

Will display the size, file name of each .DOC file.

Use a function to get rid off some limitation in the

z operator. It is especially useful with a for loop:

z1/1024 – David Doumèche Mar 18 ’14 at 2:59

The forfiles command runs command c for each file m in directory p .

The variable @fsize is replaced with the size of each file.

If the file C:\Temp\file1.txt is 27 bytes, forfiles runs this command:

Which prints 27 to the screen.

As a side-effect, it clears your screen as if you had run the cls command.

Since you’re using Windows XP, Windows PowerShell is an option.

or as a function

Create a file named filesize.cmd (and put into folder C:\Windows\System32):

In a batch file, the below works for local files, but fails for files on network hard drives

However, it’s inferior code, because it doesn’t work for files saved on a network drive (for example, \\Nas\test.jpg and \\192.168.2.40\test.jpg ). The below code works for files in any location, and I wrote it myself.

I’m sure there are more efficient ways of doing this using VBScript, or PowerShell or whatever, but I didn’t want to do any of that; good ol’ batch for me!

zI – trindflo Mar 18 ’20 at 19:23

The following command finds folders that are greater than 100 MB in size on the D: drive:

The /s option causes subdirectories to be searched, the /m option displays disk usage in megabytes, the /q:100 option causes folders that are greater than 100 MB to be marked, and the /d option displays only folders that exceed the threshold specified by /q.

Use the diskuse command to find files over a certain size. The following command displays files over 100 MB in size on the D: drive:

The /x:104857600 option causes files over 104,857,600 bytes to be displayed and is valid only if you include the /v option (verbose). The /s option means subdirectories from the specified path (in this case, the D: drive) are searched.

Оцените статью