Hi, I've got a command prompt batch script which extracts the day of week, day number, month number, year, hour and seconds. Unfortunately, whilst it does work, it gets the day number and month number confused when ran with US regional settings - and it needs to work in both UK and US settings. Is there any way around this so it extracts them correctly regardless? Whether this means using different code or modifying what I've got below...?
For /f "tokens=1-7 delims=.:/-, " %%i in ('echo exit^|command /K prompt $D $T ') do (
For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
rem the following variables are populated as described below:
rem %%i = day of week
rem %%j = day number
rem %%k = month number
rem %%l = year
rem %%m = hour
rem %%n = mins
rem %%o = seconds
)
)
For /f "tokens=1-7 delims=.:/-, " %%i in ('echo exit^|command /K prompt $D $T ') do (
For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
rem the following variables are populated as described below:
rem %%i = day of week
rem %%j = day number
rem %%k = month number
rem %%l = year
rem %%m = hour
rem %%n = mins
rem %%o = seconds
)
)