1

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.

5
  • 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, 2018 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, 2018 at 21:15
  • You may be required to create a new user profile to fix your issue...
    – LPChip
    Jun 12, 2018 at 21:22
  • Did you check here:? Computer\HKEY_CURRENT_USER\Console
    – cybernard
    Jun 12, 2018 at 23:30
  • The registry saves only the default setting, which, as I mentioned, are correct.
    – NeveraX
    Jun 13, 2018 at 9:47

2 Answers 2

0

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/>
setlocal
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
:display
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%     "
set "HKCUCon=%HKCUCon:HKEY_CURRENT_USER=HKCU%"
echo/%WSW:~-5%*%WSH:~,5%^|%SBW:~-5%*%SBH:~,5% ^| %HKCUCon%
:: ConsoleSizes.cmd ::::::::::::::::::::::::::::::::::::::::::::::::::::

Sample shorted output:

> ConsoleSizes.cmd
Window_X*Y_|_Buffer_X*Y_|_App-key_____________________________
   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

2
  • Okay but how does this solve my issue?
    – NeveraX
    Jun 13, 2018 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, 2018 at 10:24
0

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".

You can find these files here https://www.sevenforums.com/tutorials/401170-command-prompt-restore-default-personalization-settings.html

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .