Created
January 30, 2011 18:31
-
-
Save mrdaemon/803107 to your computer and use it in GitHub Desktop.
Shit example to parse the output of date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: $Id: env_universaldate.cmd 1986 2006-12-06 20:36:59Z gauthiera $ | |
:: Librarie pour generation de date Universelle | |
:: | |
:: ATTENTION: La date et le nom des variables | |
:: sont differents selon la langue du systeme | |
:: d'exploitation: | |
:: Francais: %jj% %mm% %aa% | |
:: Anglais: %mm% %dd% %yy% | |
:: | |
set $tok=1-3 | |
for /f "tokens=1 delims=.:/-, " %%u in ('date /t') do set $d1=%%u | |
if "%$d1:~0,1%" GTR "9" set $tok=2-4 | |
for /f "tokens=%$tok% delims=.:/-, " %%u in ('date /t') do ( | |
for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do ( | |
set %%x=%%u | |
set %%y=%%v | |
set %%z=%%w | |
set $d1= | |
set $tok=)) | |
if defined jj goto FRENCH | |
if defined dd goto ENGLISH | |
echo WARNING: Impossible de trouver la langue du systeme? | |
echo Contactez le support informatique avant de continuer. | |
pause | |
:ENGLISH | |
set OS_LANG=1 | |
GOTO :EOF | |
:FRENCH | |
set OS_LANG=2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment