Every time I open cmd the window size is 20x5. The problem is that even though the default settings are set to 80x25, 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 20x5 size. I've checked the registry and the values are correct, although they don't take effect.

  • Make sure the command prompt shortcuts are correct too. Command prompt windows will remember their settings based on every different instance of cmd.exe, so you can give a different program that runs through cmd.exe different settings. You are likely setting the general settings for cmd.exe, but when you actually launch cmd.exe it starts it as a different instance. You may be required to create a new user profile to fix your issue though... – LPChip Jun 12 '18 at 21:05
  • How do I change default settings of the actual cmd then? And also the issue also affects .bat files – NeveraX Jun 12 '18 at 21:15
  • You may be required to create a new user profile to fix your issue... – LPChip Jun 12 '18 at 21:22
  • Did you check here:? Computer\HKEY_CURRENT_USER\Console – cybernard Jun 12 '18 at 23:30
  • The registry saves only the default setting, which, as I mentioned, are correct. – NeveraX Jun 13 '18 at 9:47

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:

:: ConsoleSizes.cmd ::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
:: Read: <https://blogs.msdn.microsoft.com/commandline/2017/06/20/understanding-windows-console-host-settings/>
echo Window_X*Y_^|_Buffer_X*Y_^|_App-key_____________________________
for /F "tokens=1-2,*" %%A in (
  'reg query hkcu\console /s^|findstr "\ ScreenBufferS WindowS"'
) do (
    if "%%B" NEQ "REG_DWORD" (set "HKCUCon=%%A %%B %%C"&set "SBS="&SET "WS=")
    if "%%A" EQU "ScreenBufferSize" set "SBS=%%C"
    if "%%A" EQU "WindowSize" set "WS=%%C" & call :display
goto :eof
set /A "WSW=WS&0xffff, WSH=WS>>16"
set "WSW=     %WSW%"&set "WSH=%WSH%     "
set /A "SBW=SBS&0xffff, SBH=SBS>>16"
set "SBW=     %SBW%"&set "SBH=%SBH%     "
echo/%WSW:~-5%*%WSH:~,5%^|%SBW:~-5%*%SBH:~,5% ^| %HKCUCon%
:: ConsoleSizes.cmd ::::::::::::::::::::::::::::::::::::::::::::::::::::

Sample shorted output:

> ConsoleSizes.cmd
   80*25   |   80*300   | HKCU\console
  130*50   |  130*9000  | HKCU\console\%SystemRoot%_system32_bash.exe
  120*60   |  120*9000  | HKCU\console\%SystemRoot%_system32_cmd.exe
  120*52   |  120*3000  | HKCU\console\%SystemRoot%_system32_diskpart.exe
  148*60   |  148*3000  | HKCU\console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe
  120*50   |  120*3000  | HKCU\console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe
  132*60   |  132*60    | HKCU\console\C:_Program Files_Far Manager_Far.exe
  221*98   |  221*98    | HKCU\console\C:_Program Files_Far_Far.exe
  132*50   |  132*50    | HKCU\console\C:_Sys_k.exe
  132*62   |  132*3000  | HKCU\console\FreeCommander - DOS

EDIT I'd also check the Autorun egistry key

Reg query "HKCU\Software\Microsoft\Command Processor" /v AutoRun

HKEY_CURRENT_USER\Software\Microsoft\Command Processor
    AutoRun    REG_SZ    Doskey /MacroFile="C:\Users\LotPings\Aliases.txt"

And/or use autoruns by sysinternals

  • Okay but how does this solve my issue? – NeveraX Jun 13 '18 at 9:48
  • It can' help directly but possibly helps identifying where the window dimensions come from. BTW did you check if there is an Autorun defined which could alter the values? Either lookup the reg entry i'll append to the answer or use autoruns from ssysinternals. – LotPings Jun 13 '18 at 10:24

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.