Under 98 or 2000, for example if the current system date is 20051218, then how can I get the previous day's date 20051217 in a batch file?
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
-=Code coloring BY:无奈何=-
- ::Get the date
- rem Please improve it yourself
- @echo off
- for /f "tokens=1,2,3 delims=-/. " %%a in ('date /t') do (
- set A=%%a
- set B=%%b
- set C=%%c
- )
- rem set /a C-=1
- echo %A%%B%%C%
Originally posted by tigerpower at 2005-12-19 22:38:
Use GNU date:
.\date -d "-1 day" "+%Y%m%d"