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-06-22 12:00
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » Can such a batch processing be done? View 1,926 Replies 2
Original Poster Posted 2004-07-24 00:00 ·  中国 浙江 宁波 鄞州畅联信息技术有限公司
初级用户
Credits 106
Posts 1
Joined 2004-07-24 00:00
21-year member
UID 28926
Gender Male
Status Offline
There is an application that creates subdirectories named with dates under the c:\home directory every day, such as 2004-07-24. I want to use a batch process to implement the backup of this directory. I don't know how to do it well. There are nearly three months of such subdirectories in c:\home. I want to judge the directories to be backed up by comparing the current date and the directory name. Is that possible? And how to implement it?
Floor 2 Posted 2004-07-26 00:00 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
1. Your question was ignored because the title was not clear enough (it is recommended that you carefully read the sticky post). I suggest writing it like this: How to generate an environment variable with the current date as the content in batch processing?
2. The running environment you provided is not detailed enough. For example, under which system will you run this batch file, is it pure DOS, or 98, or 2k/xp/2003?
3. Your problem is not a very difficult one to solve, but different environments require different methods. Under 2k/xp/2003, you can directly use the %date% environment variable as the current date. Using Horst's varset and lmod programs can also achieve this (this should be considered a general solution, and I tested it under 2003):

varset d=date | lmod /L1 /B. -- > temp.bat
call temp.bat
del temp.bat

After the above command is run, the d environment variable will store the current date in the yyyy - mm - dd format.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 3 Posted 2004-08-25 00:00 ·  中国 广东 东莞 电信
初级用户
Credits 172
Posts 14
Joined 2004-08-25 00:00
21-year member
UID 30723
Gender Male
Status Offline
May I ask the original poster, has this problem been resolved?
Forum Jump: