Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for scrszdos.bat

(view source code of scrszdos.bat as plain text)

  1. @ECHO OFF
  2. :: Check command line
  3. IF NOT [%1]==[] GOTO Syntax
  4.  
  5. :: Store current screen size settings, using
  6. :: MODE CON command and temporary batch files.
  7.  
  8. :: Columns:
  9. MODE CON | FIND /I "Columns:" > TEMP.BAT
  10. > COLUMNS.BAT ECHO SET Columns=%%1
  11. CALL TEMP.BAT
  12.  
  13. :: Lines:
  14. MODE CON | FIND /I "Lines:" > TEMP.BAT
  15. > LINES.BAT ECHO SET Lines=%%1
  16. CALL TEMP.BAT
  17.  
  18. :: Cleanup
  19. FOR %%A IN (COLUMNS LINES TEMP) DO IF EXIST %%A.BAT DEL %%A.BAT
  20.  
  21. :: Note: the previous commands are based on MODE CON's screen output
  22. :: for English Windows versions as shown in the following lines:
  23. ::
  24. :: Status for device CON:
  25. :: ----------------------
  26. ::     Lines:          25
  27. ::     Columns:        80
  28. ::     Keyboard rate:  31
  29. ::     Keyboard delay: 1
  30. ::     Code page:      437
  31. ::
  32. :: You may need to make FIND search for other strings
  33. :: than "s:" if you use a different language version.
  34.  
  35. :: Done
  36. GOTO End
  37.  
  38.  
  39. :Syntax
  40. ECHO.
  41. ECHO ScrSzDOS.bat,  Version 1.00 for MS-DOS
  42. ECHO Save current window size -- lines and columns -- in
  43. ECHO environment variables "Lines" and "Columns".
  44. ECHO.
  45. ECHO Usage:  SCRSZDOS
  46. ECHO.
  47. ECHO Notes:  Written for English MS-DOS versions only; can be
  48. ECHO         adapted easily to other languages using this batch
  49. ECHO         file's embedded comments.
  50. ECHO.
  51. ECHO Written by Rob van der Woude
  52. ECHO http://www.robvanderwoude.com
  53.  
  54. :End
  55.  

page last uploaded: 2017-08-21, 14:26