Last active
August 26, 2017 12:53
-
-
Save xgenvn/1123786cee313875b3270304bbb86200 to your computer and use it in GitHub Desktop.
Get Date from DOS
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 on | |
:: GENERATE UNIQUE | |
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('"echo.|date"') do ( | |
for /f "tokens=1-3 delims=/.- " %%A in ("%date:* =%") do ( | |
set %%a=%%A&set %%b=%%B&set %%c=%%C)) | |
set /a "yy=10000%yy% %%10000,mm=100%mm% %% 100,dd=100%dd% %% 100" | |
for /f "tokens=1-4 delims=:. " %%A in ("%time: =0%") do @set UNIQUE=%yy%%mm%%dd%%%A%%B%%C%%D | |
:: DONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment