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-02 02:24
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Please ask experienced people for advice, thank you View 1,996 Replies 13
Original Poster Posted 2006-09-05 20:40 ·  中国 广东 茂名 盈联宽带
初级用户
Credits 22
Posts 7
Joined 2006-09-04 21:25
19-year member
UID 61844
Gender Male
Status Offline
In our unit, there are some old employees who are not very good at using computers. They often put important files on the desktop, and plus the computer often has problems, all important data are completely lost~ Although we have reminded them many times not to put them on the desktop, they just don't pay attention, which is very headache~

So I wrote a batch file and put it in the startup item, so that the desktop files are automatically backed up every time the computer starts

xcopy "E:\Documents and Settings\wind" /e d:\backup

After execution, there will be an option <yes/no/all?> asking whether to rewrite (overwrite) the previous data. It was originally a matter of just pressing "a", but those old-fashioned people even said it was troublesome and didn't know how~

The problem I need to solve is how to not display <yes/no/all?> and directly execute it~


I am a novice, just started to contact DOS, please give me some advice, great gods~
Floor 2 Posted 2006-09-05 22:06 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
echo a| xcopy "E:\Documents and Settings\wind"/e d:\backup

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 3 Posted 2006-09-06 02:27 ·  中国 广东 茂名 盈联宽带
初级用户
Credits 22
Posts 7
Joined 2006-09-04 21:25
19-year member
UID 61844
Gender Male
Status Offline
Floor 4 Posted 2006-09-06 02:49 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Does the `xcopy` command have a parameter to force overwriting without prompting? Just add the parameter `/y`.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 5 Posted 2006-09-06 04:03 ·  中国 广东 茂名 盈联宽带
初级用户
Credits 22
Posts 7
Joined 2006-09-04 21:25
19-year member
UID 61844
Gender Male
Status Offline
Hehe~ So there is this function~ Thanks
Floor 6 Posted 2006-09-06 20:49 ·  中国 广东 茂名 盈联宽带
初级用户
Credits 22
Posts 7
Joined 2006-09-04 21:25
19-year member
UID 61844
Gender Male
Status Offline
I wrote a simple batch script to back up the desktop and My Documents files when the computer starts, as follows:

@echo off
xcopy "E:\Documents and Settings\wind\Desktop" /e /q d:\backupd\Desktop /y
xcopy "E:\Documents and Settings\wind\My Documents" /e /q d:\backupd\Documents /y

This batch script can execute normally, but after using it for a while, the problems are found:
1. It automatically backs up every time the computer starts. Sometimes it restarts several times a day, and there are many files, which takes time. How can I set it to back up once a day?
2. Files that have been deleted are still present in the backup files. As other new files are added, the backup data becomes larger and larger over time, and it is cumbersome to delete manually. Can it be set to keep the backup files consistent with the original documents? (That is, files deleted in the original documents can also be automatically deleted in the backup files)
Floor 7 Posted 2006-09-06 23:05 ·  中国 广东 茂名 盈联宽带
初级用户
Credits 22
Posts 7
Joined 2006-09-04 21:25
19-year member
UID 61844
Gender Male
Status Offline
This question shouldn't be too difficult, right? :( Please give me some pointers.
Floor 8 Posted 2006-09-07 01:12 ·  中国 甘肃 张掖 临泽县 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
2. The files that have been deleted are still present in the backup files. As other new files are added, the backup data becomes larger over time, and it is cumbersome to delete manually. May I ask if it is possible to set it so that the backup files are consistent with the original documents? (That is, if the original document has been deleted, the backup file can also be automatically deleted)

I want to generate an xcopy date to complete the synchronous deletion using the date.
Floor 9 Posted 2006-09-07 01:22 ·  中国 四川 绵阳 电信
高级用户
★★
Credits 587
Posts 282
Joined 2006-04-10 03:40
20-year member
UID 53599
Gender Male
Status Offline
Using the backup program that comes with XP (Start -> Accessories -> System Tools -> Backup), if everything is solved with batch processing, why use XP?
Floor 10 Posted 2006-09-07 01:38 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Use RAR to compress and back up!

The following updates and backs up the files that have changed.

@echo off
"C:\Program Files\WinRAR\RAR" u -ep1 -r -m0 d:\backupd\桌面.rar "E:\Documents and Settings\wind\桌面\*"
"C:\Program Files\WinRAR\RAR" u -ep1 -r -m0 d:\backupd\文档.rar "E:\Documents and Settings\wind\My Documents\*"


Compression ratio adjustment
-m0 Store Do not compress files when adding to the compressed file.
-m1 Fastest Use the fastest method (low compression)
-m2 Faster Use the quick compression method
-m3 Standard Use the standard (default) compression method
-m4 Better Use a better compression method (better compression but slow)
-m5 Best Use the maximum compression method (best compression but slowest)
Floor 11 Posted 2006-09-07 02:42 ·  中国 广东 茂名 盈联宽带
初级用户
Credits 22
Posts 7
Joined 2006-09-04 21:25
19-year member
UID 61844
Gender Male
Status Offline
Excuse me, the person on the second floor, how to generate an xcopy log? Can you make three files, such as a, b, c. On the first day, back up to a. On the second day, also back up to a, and the first day's automatically transfer to b. On the third day,... That is, one backup keeps three days.
Floor 12 Posted 2006-09-07 02:45 ·  中国 广东 茂名 盈联宽带
初级用户
Credits 22
Posts 7
Joined 2006-09-04 21:25
19-year member
UID 61844
Gender Male
Status Offline
The meaning of the building owner on the 5th floor, I don't understand. Can you explain it? I'm still a newbie~
Floor 13 Posted 2006-09-09 11:05 ·  中国 山西 大同 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline

───────────────── Moderator Prompt ─────────────────
To facilitate forum user browsing and moderator management, please modify the title of this thread to briefly describe the content or intention of the thread.

If you confirm that the title does not need to be modified, please continue to reply to this thread to make a plea. If the plea is well-founded, this notice will be canceled.

If you confirm that the title needs to be modified, please click the "Edit" button below the first post of this thread and modify the title field in the editing page.

After knowing that you have made a positive and appropriate response, the moderator will delete this prompt within three working days to eliminate the adverse impact on you.
───────────────── Moderator Prompt ─────────────────


───────────────── Moderation Record ─────────────────
Executor: Will Sort
Operation: Merge thread {22971} How to improve? Please give your advice -> Posts 6~12
Explanation: The operated thread has a direct context connection with this thread
Punishment: No points punishment due to being a forum newbie
Prompt: Please visit {7326}Forum Newcomer Must-read, Basic Code of Conduct for Everyone
───────────────── Moderation Record ─────────────────


───────────────── Moderation Record ─────────────────
Executor: Will Sort
Operation: Move thread: From DOS Difficulties & Problem Discussion (Q&A Room)
Explanation: According to the content classification of the thread, it is more suitable to be posted in this forum section
Punishment: No points punishment due to being a forum newbie, please visit {7326}Forum Newcomer Must-read, Basic Code of Conduct for Everyone
───────────────── Moderation Record ─────────────────


Re forrestzheng01:

A more effective and quick way is to relocate the user's desktop directory to the specified data disk. This can be achieved using optimization tools such as Super Rabbit, or by modifying the relevant key values in the registry through a registry script or batch processing.

[ Last edited by willsort on 2006-9-9 at 11:22 ]
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 14 Posted 2006-09-18 20:55 ·  中国 广东 广州 越秀区 电信
中级用户
★★
Credits 259
Posts 112
Joined 2006-09-18 04:55
19-year member
UID 62928
Gender Male
Status Offline
Haha, learned a new trick, RAR backup!
Forum Jump: