中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-23 12:21
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » Brother, how to name a file with the current system date?
Printable Version  2,707 / 2
Floor1 posy0107 Posted 2003-08-05 00:00
初级用户 Posts 2 Credits 108
In DOS under Windows 2000, I want to name a file with the current system date. For example, today is May 6, 2003, then the file name would be 200356 or 20030506. Can this function be implemented?

Thanks a lot
Floor2 Roy Posted 2003-08-05 00:00
管理员 Posts 1,633 Credits 4,869
Win9x/ME/DOS dedicated:
rendate1.bat
-------------------
@echo off
if "%1"=="GoTo" goto %2
echo e180 BF 07 01 B4 04 CD 1A E8 02 00 89 CA E8 00 00> %temp%.\t1.src
echo e18F 86 D6 88 D0 D4 10 0D 30 30 86 C4 AB 47 C3>> %temp%.\t1.src
for %%? in (rip 180 g w q) do echo %%?>> %temp%.\t1.src
echo SET %%1=XX XX XX XX> %temp%.\t2.bat
DEBUG %temp%.\t2.bat nul
call %temp%.\t2.bat _
%0 GoTo parse %_% MM DD YC YY
:parse
set %7=%3
shift
if not "%7"=="" goto parse
for %%? in (t1.src t2.bat) do del %temp%.\%%?
set _=
-------------------

rendate.bat
----------------
call rendate1.bat
ren %1 %YC%%YY%%MM%%DD%
----------------

============================
NT/2000/XP dedicated:
rendate.bat
----------------
for /F "tokens=1-4 delims=/- " %%A in ('date/T' do set DATE=%%B%%C%%D
ren %1 %DATE%
----------------
Floor3 posy0107 Posted 2003-08-05 00:00
初级用户 Posts 2 Credits 108
Thanks, moderator.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023