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 15:35
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Question about a batch file for data copying! View 1,061 Replies 0
Original Poster Posted 2006-11-29 04:46 ·  中国 广东 广州 教育网
初级用户
Credits 26
Posts 10
Joined 2006-08-23 22:05
19-year member
UID 61147
Gender Male
Status Offline
When I do data calculations, I need to use DOS to call data. The idea is to take the data stored in e:\data\01 (that is, two time points per day in January: uwnd0100,uwnd0112,uwnd0200,uwnd0212……uwnd3112; vwnd0100,vwnd0112,……), representing the data for variable 1 on the 1st at 00:00, the 1st at 12:00, the 2nd at 00:00, the 2nd at 12:00, and so on. Each time I need to copy three consecutive sets of data, plus different variables, into e:\data\indat, that is, copy uwnd0100,uwnd0112,uwnd0200 and also vwnd0100,vwnd0112,vwnd0200 into the target folder.
The batch file I wrote myself is as follows, run.bat:
cd e:data\bat\
call provide_data.bat 0100 0112 0200

call provide_data.bat 0112 0200 0212

call provide_data.bat 0200 0212 0300

………………
Then I separately wrote another provide_data.bat to call different variables, as follows:
cd e:\data\indat
copy E:\data\01\uwd%2.dat uwd.dat
copy E:\data\01\uwd%3.dat uwdbk.dat
copy E:\data\01\uwd%1.dat uwdfr.dat

copy E:\data\01\vwd%2.dat vwd.dat
copy E:\data\01\vwd%3.dat vwdbk.dat
copy E:\data\01\vwd%1.dat vwdfr.dat
There are two questions. First, in the first bat, the number sequence at the end follows a very regular pattern, but I really can't remember how to do that in DOS. If that time series is very long, writing it out often makes your eyes blur. Is there some kind of automatic loop statement to handle writing out a whole month's worth.
Second, there are many variables in the copy section. Can I set a default path, so that each time I need data from a different folder I only have to change that default path? (Even though Replace in Notepad is very handy, I'm still afraid of missing one somewhere!)
Please give me some advice, experts! Or is there a better, simpler approach! I'm okay with data programming, but when it comes to DOS I'm a total newbie! :(
Forum Jump: