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-12 17:29
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Teach me how to create files, open files, read files, write files, and close files [Help] View 1,477 Replies 11
Original Poster Posted 2003-06-11 00:00 ·  中国 台湾 中华电信
初级用户
Credits 139
Posts 9
Joined 2003-06-11 00:00
23-year member
UID 4842
Gender Male
Status Offline
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
Floor 2 Posted 2003-06-11 00:00 ·  中国 江西 吉安 电信
版主
★★★★
Credits 7,296
Posts 1,628
Joined 2002-10-16 12:00
23-year member
UID 10
Gender Male
Status Offline
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.
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
Floor 3 Posted 2003-06-11 00:00 ·  中国 香港
管理员
★★★★
專業島民
Credits 4,869
Posts 1,633
Joined 2002-12-10 00:00
23-year member
UID 465
Gender Male
Status Offline
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



我的網站:http://mw16.2ya.com/ 我的網誌: http://scrappedblog.blogspot.com/
~
我的Winamp正在播放的歌曲:
Floor 4 Posted 2003-06-11 00:00 ·  中国 江西 吉安 电信
版主
★★★★
Credits 7,296
Posts 1,628
Joined 2002-10-16 12:00
23-year member
UID 10
Gender Male
Status Offline
One ctrl+C solves it!
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
Floor 5 Posted 2003-06-11 00:00 ·  中国 香港
管理员
★★★★
專業島民
Credits 4,869
Posts 1,633
Joined 2002-12-10 00:00
23-year member
UID 465
Gender Male
Status Offline
The following is quoted from ko20010214's post at 2003-6-11 19:48:04:
One ctrl+C solves it!
ko, did you really try it........
And you don't seem to understand the meaning of "CTTY NUL".....

我的網站:http://mw16.2ya.com/ 我的網誌: http://scrappedblog.blogspot.com/
~
我的Winamp正在播放的歌曲:
Floor 6 Posted 2003-06-11 00:00 ·  中国 香港
管理员
★★★★
專業島民
Credits 4,869
Posts 1,633
Joined 2002-12-10 00:00
23-year member
UID 465
Gender Male
Status Offline
CTTY NUL disables the screen and keyboard......
Ctrl+C/Ctrl+Break are useless too...
我的網站:http://mw16.2ya.com/ 我的網誌: http://scrappedblog.blogspot.com/
~
我的Winamp正在播放的歌曲:
Floor 7 Posted 2003-06-11 00:00 ·  中国 江西 吉安 电信
版主
★★★★
Credits 7,296
Posts 1,628
Joined 2002-10-16 12:00
23-year member
UID 10
Gender Male
Status Offline
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.
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
Floor 8 Posted 2003-06-11 00:00 ·  中国 台湾 远传电信
元老会员
★★★★★
Credits 8,312
Posts 3,551
Joined 2003-03-22 00:00
23-year member
UID 1225
Gender Male
Status Offline
x123, do you use Traditional Chinese??
MSN:tiqit2@hotmail.com
Floor 9 Posted 2003-06-11 00:00 ·  中国 台湾 中华电信
初级用户
Credits 139
Posts 9
Joined 2003-06-11 00:00
23-year member
UID 4842
Gender Male
Status Offline
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.
Floor 10 Posted 2003-06-11 00:00 ·  中国 台湾 远传电信
元老会员
★★★★★
Credits 8,312
Posts 3,551
Joined 2003-03-22 00:00
23-year member
UID 1225
Gender Male
Status Offline
MSN:tiqit2@hotmail.com
Floor 11 Posted 2003-06-12 00:00 ·  中国 台湾 中华电信
初级用户
Credits 139
Posts 9
Joined 2003-06-11 00:00
23-year member
UID 4842
Gender Male
Status Offline
http://hk.geocities.com/tiqit2/
The speed is very good
Floor 12 Posted 2003-06-12 00:00 ·  中国 台湾 远传电信
元老会员
★★★★★
Credits 8,312
Posts 3,551
Joined 2003-03-22 00:00
23-year member
UID 1225
Gender Male
Status Offline
Now the domain name of "New DOS Era" (Traditional Chinese edition) has changed
http://newdos.2ya.com/
MSN:tiqit2@hotmail.com
Forum Jump: