首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

批处理下令 for 详解【转】

2012-11-04 
批处理命令 for 详解【转】setsThe following construction can be used as a workaround:FOR %%A IN (1 2 3

批处理命令 for 详解【转】


sets
The following construction can be used as a workaround:
FOR %%A IN (1 2 3) DO CALL TEST2.BAT %%A
If TEST2.BAT looks like this:
IF "%VAR%"=="" SET VAR=%1
thenJump using?GOTO?in?command ?FOR %%A IN (1 2 3) DO GOTO=%%A
:1
ECHO 1
GOTO End
:2
ECHO 2
GOTO End
:3
ECHO 3
:End

will display different results for different command interpreters:

  • CMD.EXE (NT and OS/2) will jump to label 1
  • COMMAND.COM (DOS) will jump to label 1, then 2, then 3, without executing any of the
  • following commands, and then execute the?ECHO 3?and following commands

    ?

    ?

    ?

    ?

    ?

  • 热点排行