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-01 13:50
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] A batch file assignment question View 1,382 Replies 3
Original Poster Posted 2005-11-12 16:51 ·  中国 辽宁 大连 教育网
新手上路
Credits 6
Posts 1
Joined 2005-11-12 16:49
20-year member
UID 45119
Status Offline
Write a DOS batch file with the following functions: copy the log files from the Windows system directory into a newly created directory LOG, save the directory listing of that directory into the file dir.txt, and rename all the log files as 1.log, 2.log, 3.log...
How do I do the last part!!
Urgent!
Floor 2 Posted 2005-11-17 08:27 ·  中国 天津 红桥区 联通
中级用户
★★
Credits 347
Posts 53
Joined 2004-07-04 00:00
22-year member
UID 27798
Gender Male
Status Offline
I'll try to give my idea, but it's limited by the number of files.
See below for the files one.bat and two.bat. When running it, please execute one.bat.
Floor 3 Posted 2005-11-17 08:28 ·  中国 天津 红桥区 联通
中级用户
★★
Credits 347
Posts 53
Joined 2004-07-04 00:00
22-year member
UID 27798
Gender Male
Status Offline
@echo off
set number=1
for %%u in (C:\Winnt\*.log) do call two.bat %%u 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
rem The numbers continue up to the upper limit of the file count
Floor 4 Posted 2005-11-17 08:28 ·  中国 天津 红桥区 联通
中级用户
★★
Credits 347
Posts 53
Joined 2004-07-04 00:00
22-year member
UID 27798
Gender Male
Status Offline
Forum Jump: