我正在构建文件排序脚本,我希望它使用相同的变量搜索多个源文件夹。这是怎么做到的?
小例子;
@echo off
SET "sourcedir=%a%"
SET "softdir=P:\=Programs"
SET "%a%=C:\downloads1"
SET "%a%=S:\downloads2"
SET "%a%=O:\downloads3"
:progs
IF EXIST "%a%\*.rar" (MOVE /-y "%a%\*.rar" "%softdir%\" )
IF EXIST "%a%\*.exe" (MOVE /-y "%a%\*.exe" "%softdir%\" )
IF EXIST "%a%\*.iso" (MOVE /-y "%a%\*.iso" "%softdir%\" )
答案 0 :(得分:0)
即for
将为您做什么:
for %%i in ("c:\downloads1" "s:\downloads2" "o:\downloads") do (
echo processing %i ...
if exist "%i\*.rar (MOVE /-y "%i\*.rar" "%softdir%\" )
)