![]() |
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-08-04 04:39 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » [Help] Batch file to back up files into a folder created with the current date as its name |
| Printable Version 740 / 6 |
| Floor1 maraholp | Posted 2007-04-12 07:20 |
| 初级用户 Posts 11 Credits 28 | |
|
Hello everyone, I just started learning to write batch files, and I ran into a problem,
Right now I want to write one that automatically creates a folder named with the current date, and automatically copies files into that folder Asking the experts for some guidance·! Thanks in advance·· |
|
| Floor2 slore | Posted 2007-04-12 07:50 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
echo %date:~0,10% and see what result you get? Then do MD and MOVE yourself
|
|
| Floor3 htysm | Posted 2007-04-12 08:51 |
| 高级用户 Posts 415 Credits 866 | |
| Floor4 kcdsw | Posted 2007-04-12 10:45 |
| 中级用户 Posts 179 Credits 404 | |
| Floor5 maraholp | Posted 2007-04-12 23:12 |
| 初级用户 Posts 11 Credits 28 | |
|
I tested md d:\%date:~0,10%
but no folder was created? |
|
| Floor6 maraholp | Posted 2007-04-13 00:38 |
| 初级用户 Posts 11 Credits 28 | |
|
Just now I used
md d:\“%date:~0,10%” to create a file, but the folders it created were d:\07\04\12 — the year, month, and day each became a separate folder What I want is d:\070412 Please advise, experts |
|
| Floor7 maraholp | Posted 2007-04-13 00:41 |
| 初级用户 Posts 11 Credits 28 | |
|
Problem solved. I changed the date format to 07-04-12 and then it worked
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |