China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

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!

中国DOS联盟论坛
The time now is 2026-07-06 05:30
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Brother, how to name a file with the current system date? View 2,524 Replies 2
Original Poster Posted 2003-08-05 00:00 ·  中国 北京 263网络通信股份有限公司
初级用户
Credits 108
Posts 2
Joined 2003-08-05 00:00
22-year member
UID 8079
Gender Female
Status Offline
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
Floor 2 Posted 2003-08-05 00:00 ·  中国 香港
管理员
★★★★
專業島民
Credits 4,869
Posts 1,633
Joined 2002-12-10 00:00
23-year member
UID 465
Gender Male
Status Offline
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%
----------------
我的網站:http://mw16.2ya.com/ 我的網誌: http://scrappedblog.blogspot.com/
~
我的Winamp正在播放的歌曲:
Floor 3 Posted 2003-08-05 00:00 ·  中国 北京 263网络通信股份有限公司
初级用户
Credits 108
Posts 2
Joined 2003-08-05 00:00
22-year member
UID 8079
Gender Female
Status Offline
Thanks, moderator.
Forum Jump: