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,689 of 68,980   
   Kerr-Mudd,John to All   
   Re: Get screen width (in characters) in    
   19 Nov 20 22:06:50   
   
   From: notsaying@127.0.0.1   
      
   On Thu, 19 Nov 2020 16:43:13 GMT, "Kerr-Mudd,John"    
   wrote:   
      
   > On Thu, 19 Nov 2020 00:48:56 GMT, gazelle@shell.xmission.com (Kenny   
   > McCormack) wrote:   
   >   
   >> 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?   
   >>   
   > Sure. What's my fee?   
   >   
   >   
   Sorry, I was a bit grumpy earlier;   
      
   @echo off   
   rem mode con: cols=97   
   for /F "tokens=1,2 delims= " %%i in ('mode con:') do if %%i==Columns:   
   echo cols=%%j   
      
      
   --   
   Bah, and indeed, Humbug.   
      
   --- 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