C:\_G\WWW\~ELISANET\INFO\tscmd011.html
<https://www.salminet.fi/info/tscmd011.html>
Copyright © 2003- by Prof. Timo Salmi  
Last modified Fri 30-Nov-2018 10:49:53

 
Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
 

This page is edited from the 1cmdfaq.txt faq-file contained in my tscmd.zip command line interface (CLI) collection. That zipped file has much additional material, including a number of detached .cmd script files. It is recommended that you also get the zipped version as a companion.

Please see "The Description and the Index page" for the conditions of usage and other such information.



11} How do I retain my original code page in these scripts?

  @echo off & setlocal enableextensions
  for /f "tokens=3 delims= " %%p in (
    'mode con: codepage /status ^| find "Code page"') do (
    set store_codepage_=%%p)
  echo The stored codepage is %store_codepage_%
  ::
  rem 850 (Multilingual Latin I)
  mode con: codepage select=850
  echo Whatever ...
  ::
  mode con: codepage select=%store_codepage_%
  endlocal & goto :EOF

Alternatively, and more concisely, one could have
  @echo off & setlocal enableextensions
  for /f "tokens=4" %%p in ('chcp') do set store_codepage_=%%p
  echo The stored codepage is %store_codepage_%
  ::
  rem 850 (Multilingual Latin I)
  chcp 850
  echo Whatever ...
  ::
  chcp %store_codepage_%
  endlocal & goto :EOF

More importantly, below are the regional settings which are used in this FAQ collection and which directly affect the date and time presentations. Hence, if your locale's diverge, some of the scripts will need appropriate adjustments.

Likewise, some scripts may be affected by setting the time zone environment variable TZ. When set in this FAQ, it will have the value Europe/Helsinki or on occasions it must not be set at all to get the datetime stamps right. For example, some touch utilities confuse the datestamps if TZ is set. On the other hand the MS-DOS PGP program requires that TZ is set.

References/Comments:
  hh ntcmds.chm::/mode.htm [You can't use this unless you have the ntcmds.chm file]
  Code page Wikipedia
  Windows OEM Code Pages
  ISO Code Pages

[Previous] [Next]

C:\_G\WWW\~ELISANET\INFO\tscmd011.html
C:\_G\WWW\~ELISANET\FTPCMD\TSALMI.CMD /tscmd011
https://www.salminet.fi/info/tscmd011.html
file:///c:/_g/www/~elisanet/info/tscmd011.html