[Windows7] [cmd] goto

COM2010. 11. 8. 16:12 |

Directs cmd.exe to a labeled line in a batch program.

GOTO label

  label   Specifies a text string used in the batch program as a label.

You type a label on a line by itself, beginning with a colon.                              레이블링은, 콜론 :  으로 시작한다.


If Command Extensions are enabled GOTO changes as follows:

GOTO command now accepts a target label of :EOF which transfers control to the end of the current batch script file.

This is an easy way to exit a batch script file without defining a label.

Type CALL /?  for a description of extensions to the CALL command that make this feature useful.




팁.


GOTO %1
:a
~~~~~
GOTO END

:b
~~~~~
GOTO END

:c
~~~~
:END

와 같은 식으로 짜면, 파일명 다음에 오는 인자에 따라서, 다중분기할수 있다.