@echo off & setlocal enableextensions
set tmpfile_=%temp%\cmdfaq.tmp
reg query "HKEY_CURRENT_USER\Control Panel\International">"%tmpfile_%"
::
for /f "tokens=3" %%a in ('more "%tmpfile_%"^|find "sDate "') do (
set sDate_=%%a)
if defined sDate_ (
echo sDate_=%sDate_%
) else (
echo sDate_=Space or none)
::
for /f "tokens=3" %%a in ('more "%tmpfile_%"^|find "sShortDate "') do (
set sShortDate_=%%a)
if defined sShortDate_ (
echo sShortDate_=%sShortDate_%
) else (
echo sShortDate_=none)
::
for /f "tokens=3" %%a in ('more "%tmpfile_%"^|find "sTime "') do (
set sTime_=%%a)
if defined sTime_ (
echo sTime_=%sTime_%
) else (
echo sTime_=Space or none)
::
for /f "tokens=3" %%a in ('more "%tmpfile_%"^|find "sTimeFormat "') do (
set sTimeFormat_=%%a)
if defined sTimeFormat_ (
echo sTimeFormat_=%sTimeFormat_%
) else (
echo sTimeFormat_=none)
::
for %%f in ("%temfile_%") do if exist %%f del %%f
endlocal & goto :EOF
The output might be e.g.
C:\_D\TEST>cmdfaq
sDate_=.
sShortDate_=dd.MM.yyyy
sTime_=:
sTimeFormat_=HH:mm:ss
@echo off & setlocal enableextensions
for /F "tokens=1,2,*" %%a in (
'reg query "HKCU\Control Panel\International"
^|findstr "sDate sShortDate sTime sTimeFormatsYearMonth"') do (
set %%a=%%c)
echo sDate=%sDate%
echo sShortDate=%sShortDate%
echo sTime=%sTime%
echo sTimeFormat=%sTimeFormat%
endlocal & goto :EOF
The output might be e.g.
C:\_D\TEST>cmdfaq
sDate=.
sShortDate=dd.MM.yyyy
sTime=:
sTimeFormat=HH:mm:ss