- ©«¤l
- 83
- ¥DÃD
- 73
- ºëµØ
- 0
- ¿n¤À
- 164
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-8-12
- ³Ì«áµn¿ý
- 2015-12-13
|
[¤À¨É] ¦ó¿×§å¦¸ÀÉ(Batch File)¡H
§å¦¸Àɪº³W®æ¡G
01.º¥ý§å¦¸ÀÉn¥H¯Â¤å¦r¼g¥X¡A¬O¤@ºØ¤å¦rÀɮס]ASCIIÀɮס^¡A¥Ñ¤@³s¦êªºMS-DOS©R¥O©Ò²Õ¦¨ªº¡A¨C¤@¦æ³£¬O¤@±øDOS«ü¥O¡]¤j³¡¤À®ÉÔ´N¦n¹³§Ú̦bDOS´£¥Ü¸¹¤U°õ¦æªº«ü¥O¦æ¤@¼Ë¡^¡A¨C¤@¶µ«ü¥O¡]¥]¬A¤º³¡«ü¥O©M¥~³¡«ü¥O¡^n¦b¤@¦æ¤¤§¹¦¨¡A¤£¯à¤À¨â¦æ¡A¨C¦æ³Ì¦h¬O 127 Ó¦r¡A¨âÓ«ü¥O´Nn¤À¨â¦æ (©Î¥Î³sµ²²Å¸¹)¡C ¦Ó§å¦¸³B²zªº¯à¤O¥Dn¨ú¨M©ó§A©Ò¨Ï¥Îªº«ü¥O¡C
02.¨ä¦¸§å¦¸Àɪº©R¦W³W«h»P¤@¯ëÀɮ׬ۦP¡A§Y "±N ¤@³s¦êªº©R¥O" Àx¦s¦bÀɮפ¤¡AÀɮצW©T©wn¥Î .bat ¬°°ÆÀɦW(¦bnt/2000/xp/2003¤U¤]¥i¥H¥Î.cmd)¡A°£¤F Autoexec.bat¡A¥DÀɦW¥Ñ¨Ï¥ÎªÌ¦Û©w¡A¦ý³Ì¦nÁקK©M DOS «ü¥O¦P¦W¡A¨Ò¦p¤£n¥Î Copy.bat¡BDel.bat¡BDir.bat¡BExit.bat µ¥µ¥¡A¸Ó§å¦¸Àɪº«ü¥O¥iµL¨îªº«ÂШϥΡA¥Ã»·±o¨ì¬Û¦Pªº°õ¦æµ²ªG¡C
03.§å¦¸ÀɻݥΠDOS «ü¥O¥[¤W¯S©w»y¦¸¼g¦¨¡A³o¨Ç«ü¥O¥]¬A DOS ¤º³¡¤Î¥~³¡«ü¥O¡A»yªk¦³¥H¤U¦U¶µ¡G
call choice echo
for...in...do goto if(if exit)(if not exist)
pause rem shift
¡@«ü¥O¿ù»~·|¦³ "Bad command or file name" ¦^À³¡A»yªk¿ù»~·|¦³ " Syntax error" ªº¦^À³¡C
04.n DOS °õ¦æ§å¦¸Àɪº«ü¥O¡A¥u»ÝÁä¤J¥DÀɦW¡A¨Ò¦p Menu.bat ©Î menu¡C¤£¹LY§å¦¸Àɪº¥DÀɦW©M .com ©Î .exe ªº¥DÀɦW¬Û¦P®É¡A´NnÁä¤J¥þ¦W¡A¨Ò¦p§å¦¸Àɪº¦WºÙ¬O copy.bat ©Î edit.bat®É¡A´NnÁä¤Jcopy.bat ©Î edit.bat ¤~¯à¨Ï¹q¸£°õ¦æ§å¦¸Àɪº«ü¥O¡A§_«h¹q¸£·|°õ¦æ copy.exe ©Î edit.com ³o¨Ç DOS «ü¥O¡C
05.¦b§å¦¸ÀÉ°õ¦æ³~¤¤¡A¤@°_«ö¤U [Ctrl]+[C] ©Î [Ctrl]+[Break] ¥i²×¤îµ{§Ç¡C«ö¤U³o¨âÓÁä«á¡A¿Ã¹õ·|Åã¥Ü¡GTerminate batch job (y/N)? «ö [Y] ·|²×¤î³o§å¦¸ÀÉ©M¦^¨ì DOS ªº´£¥Ü¸¹¡A«ö [N] «h¨ú®ø[Ctrl]+[C] «ü¥O¡A§å¦¸ÀÉ·|Ä~Äò°õ¦æµ{§Ç¡C
06.¦´Á¦bDOS¨t²Î¤u§@¤U¡A³£¥i¯à»Ýn¨Ï¥Î§å¦¸ÀɨӰõ¦æ¹q¸£¤u§@¡A·í¤å¦r¤¶±ªº¨t²Î³vº¥³QWindows¡BUnix¨t²Î¡]¹Ï§Î¤¶±¡^©Ò¨ú¥N®É¡A²{¤µ¤@¯ë¨Ï¥Î¹q¸£ªº¤H¡A¥i¯à¤]¤£¬O«Ü²M·¡¤°»ò¬O§å¦¸ÀÉ¡A§Ṳ́µ¤Ñ´N¨Ó¤¶²Ð¦ó¿×§å¦¸ÀÉ¡C
07.³oÓ¤å¥ó§A¥i¥H¨Ï¥ÎDOS¤UªºEdit©ÎªÌWindowsªº°O¨Æ¥»(notepad)µ¥¥ô¦ó¤å¥»¤å¥ó½s¿è¤u¨ã·s¼W©Mקï§å¦¸³B²z¤å¥ó¡A¦b©R¥O´£¥Ü¤UÁä¤J§å¦¸ÀɦWºÙ©Î¬O´å¼Ð·Æ¹«¥ªÁäÂùÀ»§å¦¸ÀÉ¡A¨t²Î·|½Õ¥ÎCmd.exe¨Ó¹B¦æ§å¦¸ÀÉ¡C
08.§å¦¸³B²z¤å¥ó¬O¤@ºØ²³æªºµ{§Ç¡A¥i¥H³q¹L±ø¥ó»y¥y(if)©M¬yµ{±±¨î»y¥y(goto)¨Ó±±¨î«ü¥O°õ¦æªº¬yµ{¡A¦b§å¦¸³B²z¤¤¤]¥i¥H¨Ï¥Î´`Àô»y¥y(for)¨Ó´`Àô°õ¦æ¤@±ø«ü¥O¡C
09.·íµM¡A§å¦¸³B²z¤å¥óªº½sµ{¯à¤O»PC»y¨¥µ¥½sµ{»y¥y¤ñ°_¨Ó¬O¤Q¤À¦³ªº¡C¨CÓ½s¼g¦nªº§å¦¸³B²z¤å¥ó³£¬Û·í©ó¤@ÓDOSªº¥~³¡«ü¥O¡A§A¥i¥H§â¥¦©Ò¦bªº¥Ø¿ý©ñ¨ì§AªºDOS·j´M¸ô®|(path)¤¤¨Ó¨Ï±o¥¦¥i¥H¦b¥ô·N¦ì¸m°õ¦æ¡C
10.¤@Ó¨}¦nªº²ßºD¬O¦bµwºÐ¤W«Ø¥ß¤@Óbat©ÎªÌbatch¥Ø¿ý¡]¨Ò¦pC:\BATCH¡^¡AµM«á±N©Ò¦³§A½s¼g ªº§å¦¸³B²z¤å¥ó©ñ¨ì¸Ó¥Ø¿ý¤¤¡A³o¼Ë¥un¦bpath¤¤³]©w¤Wc:\batch¡A§A´N¥i¥H¦b¥ô·N¦ì¸m°õ¦æ©Ò¦³§A½s¼gªº§å¦¸³B²zµ{§Ç¡C
°õ¦æ±
• ±N¦hÓ«ü¥O¸m©ó¦P¤@ÀɮסAÅýOS¤@¦¸°õ¦æ(¦Û°Êªº³sÄò°õ¦æ¦h±ø«ü¥O)
• ¤å¦r®æ¦¡¡A¥ÑWindowsªºcmd.exe¸ÑŪ
• ´£¨Ñ¦hºØ«ü¥O
§å¦¸«ü¥O(cmd.exe´£¨Ñ)
¤º³¡«ü¥O(cmd.exe´£¨Ñ)
¥~³¡«ü¥O(OS/User´£¨Ñ)
• ª©¥»ºt¶i¡GDOS -> Win9x -> Win2000/WinXP
• §å³B²zªºÀɮפå¥ó°ÆÀɦW¬° .bat ©Î .cmd¡C
• ¤j¤p¼g¤£±Ó·P¡]©R¥O¦r¤¸©¿²¤¤j¤p¼g¡^
• ÀuÂI¡Gcmd.exe¬°OS¤º«Ø¡A³q¥Î¡B²³æ¡B¤£¥Î½sĶ¡C¯S§O¾A¥Î©ó¤å¦rÀÉ¡A³B²z¥Î§å¦¸³B²z¡A´N¥i¥H¹ê²{±N³o¨Ç³Â·Ðªº¾Þ§@²³æ¤Æ¡C
• ¯ÊÂI¡G³t«×¤£§Ö¡BµLªk¼¶¼g½ÆÂø°Ê§@¡A
À³¥Î±
• ±Æµ{©w®É¡GGUI¤è¦¡¡B§å¦¸Àɪ©¥»
• §ó§ïIP¡GGUIª©¥»¡B§å¦¸ª©¥»
• µn¤J®ÉÅÜ´«®à±
• ¦Û°Ê¦¬°e«H
• ¦Û°Êµn¤Jbbs
• ¦Û°Êftp¤U¸ü
• ¦Û°Ê¤Ægoogle¬d¸ß
• ¦Û°Ê¤ÆMP3À£ÁY
• ¦Û°Ê³Æ¥÷¸ê®Æ
• ¦Û°Ê¤Æ¶Ç°e²°T
• ¦Û°Ê³]©w·j´M¸ô®|
• ¦Û°Ê½Õ¤J·Æ¹«ÅX°Ê©MºÏ·Þ§Ö¨ú
• ¦Û°Ê³]©w¨t²ÎÀô¹ÒÅܼÆ
• ¦Û°Ê²M²z©U§£.¶}±Òµ{¦¡.¨t²ÎÃö¾÷................
• ÁÙº¡¦hªº,«Ý«áÄò¶K¤å¦@¦P°Q½× |
|