![]() |
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-02 14:18 |
48,038 topics / 350,123 posts / today 1 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Question about a batch file for data copying! |
| Printable Version 1,060 / 0 |
| Floor1 wjj137404 | Posted 2006-11-29 04:46 |
| 初级用户 Posts 10 Credits 26 | |
|
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! :( |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |