For loop 在批处理脚本中使用for循环跳过特定目录
我正在尝试处理给定目录中存在的所有目录。但是,我想跳过一组特定的目录,我知道这些目录的名称。这是伪代码For loop 在批处理脚本中使用for循环跳过特定目录,for-loop,batch-file,For Loop,Batch File,我正在尝试处理给定目录中存在的所有目录。但是,我想跳过一组特定的目录,我知道这些目录的名称。这是伪代码 for /D %%G in ("%ROOT_VAR%\mainDirectory\*") do ( if "%%G" == "%%ROOT_VAR%%\mainDirectory\dir_to_be_skipped" ( echo "Skipping dir_to_be_skipped" ) continue processing other directory 如何在批处理脚本中实现这一
for /D %%G in ("%ROOT_VAR%\mainDirectory\*") do (
if "%%G" == "%%ROOT_VAR%%\mainDirectory\dir_to_be_skipped" (
echo "Skipping dir_to_be_skipped"
)
continue processing other directory
如何在批处理脚本中实现这一点?我只想跳过处理dir\u to\u be\u跳过
谢谢
凯利轻松!添加一个
else
:
for /D %%G in ("%ROOT_VAR%\mainDirectory\*") do (
if "%%G" == "%%ROOT_VAR%%\mainDirectory\dir_to_be_skipped" (
echo "Skipping dir_to_be_skipped"
) else (
continue processing other directory
)
)
请注意,
)其他(
必须都在同一行。@Kelly,你所得到的有什么问题吗?它对我有用。。例如,你不是第一个问这个问题的人。@Blorgbeard,它不会跳过dir\u to\u be\u skipped,@Kelly好的,检查我的答案answer@Blorgbeard它起作用了!我以前试过,但没有把它放在其他地方(在同一行。