|
Answer» Hi
How to check console window width columns in bath script?Parse output of mode con command using FOR /F. Note: must escape PIPE symbol | with caret ^.
echo off for /f "tokens=1-2" %%A in ('mode con ^| find "Columns"') do set colwide=%%B echo This console is %colwide% columns wide. pause
Output of batch:
C:\>colwidth.bat This console is 104 columns wide. Press any key to continue . . .
Complete output of mode con
C:\>mode con
Status for device CON: ---------------------- Lines: 9001 Columns: 104 Keyboard rate: 31 Keyboard delay: 1 Code page: 850
Note: Height is height of buffer, not height of window.
|