![]() |
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-12 16:30 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS学习入门 & 精彩文章 (教学室) » Teach me how to create files, open files, read files, write files, and close files [Help] |
| Printable Version 1,475 / 11 |
| Floor1 x123 | Posted 2003-06-11 00:00 |
| 初级用户 Posts 9 Credits 139 | |
|
At a time when you can't find DOS manuals in bookstores, being able to find a site dedicated to teaching DOS is really exciting!
Moderator, Could you teach me how to create files, open files, read files, write files, and close files, and how to substitute the contents read from a file into parameters and variables? In my 98 boot disk I added xcopy.exe smartdrv.exe deltree.exe xcopy32.mod edit.com Because I have an a.mp3 on D:, and I want to use a .bat method to copy a.mp3 ten thousand times to D:\SP\, with the filenames after COPY increasing from 1 to 10000. So I referred to some beginner books and tried writing it, but with my poor ability I've spent more than a week and nearly 50 hours and still can't make it work, it's always wrong. So could you please give me some guidance! Thank you! Below is the wrong edit after I don't know how many tries and how many modifications, until my head became a complete mess. Please correct it for me. :WIN2000 md d:\win2000 edit d:\win2000\sd.txt echo "0" >d:\win2000\sd.tx goto sdd :sdd a: type d:\win2000\sd.txt "$sd"="%0" if "$sd" not exist "10000" do xcopy d:\a.txt d:\win2000\ $sd++ ren d:\win2000\a.txt $sd.txt if "$sd" == "10000" goto END goto sdd |
|
| Floor2 ko20010214 | Posted 2003-06-11 00:00 |
| 版主 Posts 1,628 Credits 7,296 | |
|
Sheesh, are you planning to write a virus? 10,000 copies of an MP3 would need 40 to 50 thousand megabytes of space. If 40G to 50G of space gets completely used up by copying the same MP3, that would be terrible.
|
|
| Floor3 Roy | Posted 2003-06-11 00:00 |
| 管理员 Posts 1,633 Credits 4,869 | |
|
How about this instead......
When this file runs, its size will increase at a geometric rate....... HDFILL.BAT ---------------- @CTTY NUL @COPY HDFILL.BAT HDFILL.$$$ >NUL @COPY HDFILL.BAT+HDFILL.$$$ >NUL |
|
| Floor4 ko20010214 | Posted 2003-06-11 00:00 |
| 版主 Posts 1,628 Credits 7,296 | |
|
One ctrl+C solves it!
|
|
| Floor5 Roy | Posted 2003-06-11 00:00 |
| 管理员 Posts 1,633 Credits 4,869 | |
The following is quoted from ko20010214's post at 2003-6-11 19:48:04:ko, did you really try it........ And you don't seem to understand the meaning of "CTTY NUL"..... |
|
| Floor6 Roy | Posted 2003-06-11 00:00 |
| 管理员 Posts 1,633 Credits 4,869 | |
|
CTTY NUL disables the screen and keyboard......
Ctrl+C/Ctrl+Break are useless too... |
|
| Floor7 ko20010214 | Posted 2003-06-11 00:00 |
| 版主 Posts 1,628 Credits 7,296 | |
|
Sheesh, I didn't see this line... hehe... sorry.
Then the only choice is reset... just can't let you fill the hard disk with junk. Hehe... Actually, I tried it before too... and not COPY HDFILL.BAT+HDFILL.$$$ but copying a file that was itself already very large, looping endlessly. After a few times it became very slow... Also, is ctty NUL some kind of toggle command? (That is, does the second time turn the keyboard back on?) I don't remember very clearly, and can't be bothered to try it... How do you turn the console on and off, and what exactly are the parameters? Explain it a bit. |
|
| Floor8 Dark-Destroy | Posted 2003-06-11 00:00 |
| 元老会员 Posts 3,551 Credits 8,312 | |
|
x123, do you use Traditional Chinese??
|
|
| Floor9 x123 | Posted 2003-06-11 00:00 |
| 初级用户 Posts 9 Credits 139 | |
|
Yes; I use Traditional Chinese, because I'm in Taiwan. I can't connect to the URL "http://newdos.idv.st/ "; the webpage can't be displayed.
My file's playback time is only 7 seconds and it's only 128k, but if I wanted to use it as a virus file, filling up the hard disk would be no difficult matter. (128K times 10000) divided by 1024 == 1250MB That isn't too outrageous. Calculated that way, I only need to run it 5000 times, which is just about the capacity of one CD-R. I once used the for command, but it can only repeatedly do work with certain fixed rules, and can't use FOR for loop operations the way the Perl language can, so I need to learn how to use DOS to create files such as *.txt, open files, read files, write files, close files, and how to substitute the contents read from a file into parameters and variables. Only then can I write the control for this batch file in my own way. Actually I don't understand either why CTTY has to be used to change keyboard input and screen output; I want to know that too. Thanks in advance, everyone. |
|
| Floor10 Dark-Destroy | Posted 2003-06-11 00:00 |
| 元老会员 Posts 3,551 Credits 8,312 | |
| Floor11 x123 | Posted 2003-06-12 00:00 |
| 初级用户 Posts 9 Credits 139 | |
|
http://hk.geocities.com/tiqit2/
The speed is very good |
|
| Floor12 Dark-Destroy | Posted 2003-06-12 00:00 |
| 元老会员 Posts 3,551 Credits 8,312 | |
|
Now the domain name of "New DOS Era" (Traditional Chinese edition) has changed
http://newdos.2ya.com/ |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |