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-08-04 03:12
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » More on creating folders View 747 Replies 2
Original Poster Posted 2007-04-13 20:48 ·  中国 江苏 苏州 电信
中级用户
★★
Credits 238
Posts 98
Joined 2007-04-10 07:50
19-year member
UID 84593
Gender Male
From 陕西
Status Offline
With guidance from all you experts,
@echo off
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~0,10%') do md d:\%%i%%j%%k
I found a way to create, under a specified path, a folder named with the current date, but after trying many methods I still can't create a folder named with yesterday's date ;), does any expert have a good trick? Please give me some pointers:
Thanks!
一切皆有可能!我行!我能!
Floor 2 Posted 2007-04-13 21:11 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
@echo off & setlocal enabledelayedexpansion
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~0,10%') do set /a yesterday=%%k-1 && md d:\%%i%%j!yesterday!

You'll have to think about the cross-month issue yourself;

Actually, for this kind of cross-month and date problem, vbs is much more powerful
Floor 3 Posted 2007-04-14 12:05 ·  中国 江苏 苏州 电信
中级用户
★★
Credits 238
Posts 98
Joined 2007-04-10 07:50
19-year member
UID 84593
Gender Male
From 陕西
Status Offline
So once it crosses into another month there's no way?
Is there anything more intelligent?
一切皆有可能!我行!我能!
Forum Jump: