home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,720 of 68,980   
   mokomoji to All   
   Re: Get screen width (in characters) in    
   25 Jan 21 02:00:37   
   
   From: mokomoji@naver.com   
      
   2020년 11월 19일 목요일 오전 9시 48분 58초 UTC+9에 Kenny   
   McCormack님이 작성한 내용:   
   > In a batch file, I want to get the width of the screen (e.g., 80, in the    
   > normal case) into a variable. This is, e.g., the number displayed in the    
   > "Properties" of the Command Prompt window - as the "screen width".    
   >    
   > I know how to get this is in a regular programming language (e.g., C or    
   > C++), using a Win32 API call, but I don't know of any easy way to get it    
   > purely in batch (CMD.EXE).    
   >    
   > Also, not interested in any solutions that involve things like PowerShell    
   > or VBA. As I said, if it requires going to a regular programming language,    
   > I already know how to do that.    
   >    
   > Any ideas?    
   >    
   > --    
   > "The party of Lincoln has become the party of John Wilkes Booth."    
   >    
   > - Carlos Alazraqui -   
      
      
   @echo off   
   setlocal   
   cd /d "%~dp0"   
   chcp 437   
   cls    
   for /f "tokens=1* delims=: " %%f in ('mode con') do (   
   call set /a z_num+=1   
   call set "z_mode_%%z_num%%=%%~g"   
   )   
   echo lines=%z_mode_3%   
   echo colums=%z_mode_4%   
   :end   
   endlocal   
   pause   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca