@echo off for /l %%f in (99930001,1,99930007) do ( md %%f copy *.ini %%f copy *.zip %%f )
Using Multiple Commands in a For Loop
CMD lets you use multiple command lines after a for loop. This makes the Windows XP forcommand much more powerful than the old DOS version. In cases where you would have had to call a batch file subroutine in the past, you can now use parentheses to perform complex operations.
For example, this batch file examines a directory full of Windows bitmap (BMP) files and makes sure that there is a corresponding GIF file in another directory; if the GIF file doesn't exist, it uses an image-conversion utility to create one:
@echo off
setlocal
echo Searching for new .BMP files...
for %%F in (c:\incoming\*.bmp) do (
rem output file is input file name with extension .GIF
set outfile=c:\outgoing\%%~nF.gif
if not exist %outfile% (
echo ...Creating %outfile%
imgcnv -gif %%F %outfile%
)
)
本文介绍如何利用Windows CMD命令行工具进行批量文件处理任务,包括创建目录、复制文件等操作,并展示了一个具体示例,该示例通过一个批处理脚本检查指定目录中的所有Windows位图(BMP)文件,并确保在另一个目录中有对应的GIF文件存在,如果不存在则使用图像转换工具创建。
7301

被折叠的 条评论
为什么被折叠?



