我目前正在尝试编写一个可以遍历一组文件夹的.cmd Windows Shell脚本。然而即使是最简单的如下脚本:如何迭代Windows Shell中的一组文件夹?
echo "%ROOT%"
for %%f in ("%ROOT%\Binaries\") do (
echo "%%f"
if not exist "%%f\Subfolder"
md "%%f\Subfolder"
)
输出:
CurrentDir>echo "<ActualPathToRoot>"
"<ActualPathToRoot>"
%f\Subfolder was unexpected at this time
CurrentDir>if exists "%f\Subfolder"
我在做什么错?如何修改该脚本,以便它遍历该文件夹,并且一旦看到没有名为“Subfolder”的子文件夹,它就会创建该子文件夹?还有写这样的脚本的一个很好的教程?
它应该全部在一条线上吗? – sharptooth 2010-12-07 11:41:37