批处理 - 简化FOR语句
对FOR循环不是很熟悉,请大家帮忙看看。输出2个目录下的文件夹名称,根据“E:\测试\文件夹”下的文件夹名称列表,更改“E:\测试\AD”下的文件夹名称。(理论上来说,不...
对FOR循环不是很熟悉,请大家帮忙看看。
输出2个目录下的文件夹名称,根据“E:\测试\文件夹”下的文件夹名称 列表,更改“E:\测试\AD ”下的文件夹名称。
(理论上来说,不管“E:\测试\文件夹”下有多少个文件夹,都会逐一更改“E:\测试\AD ”下的文件夹)
谢谢!
dir /b E:\测试\文件夹 >c:\windows\temp\ad.txt
dir /b E:\测试\AD >c:\windows\temp\aad.txt
(for /l %%a in (1 1 1) do set /p ad1=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 2) do set /p ad2=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 3) do set /p ad3=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 4) do set /p ad4=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 5) do set /p ad5=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 6) do set /p ad6=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 7) do set /p ad7=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 8) do set /p ad8=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 9) do set /p ad9=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 10) do set /p ad10=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 1) do set /p aad1=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 2) do set /p aad2=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 3) do set /p aad3=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 4) do set /p aad4=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 5) do set /p aad5=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 6) do set /p aad6=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 7) do set /p aad7=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 8) do set /p aad8=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 9) do set /p aad9=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 10) do set /p aad10=)<c:\windows\temp\aad.txt
ren E:\测试\AD\%aad1% %ad1%
ren E:\测试\AD\%aad2% %ad2%
ren E:\测试\AD\%aad3% %ad3%
ren E:\测试\AD\%aad4% %ad4%
ren E:\测试\AD\%aad5% %ad5%
ren E:\测试\AD\%aad6% %ad6%
ren E:\测试\AD\%aad7% %ad7%
ren E:\测试\AD\%aad8% %ad8%
ren E:\测试\AD\%aad9% %ad9%
ren E:\测试\AD\%aad10% %ad10%
xcopy e:\测试\AD\*.* E:\测试\文件夹\ /y /h /r /k /s 展开
输出2个目录下的文件夹名称,根据“E:\测试\文件夹”下的文件夹名称 列表,更改“E:\测试\AD ”下的文件夹名称。
(理论上来说,不管“E:\测试\文件夹”下有多少个文件夹,都会逐一更改“E:\测试\AD ”下的文件夹)
谢谢!
dir /b E:\测试\文件夹 >c:\windows\temp\ad.txt
dir /b E:\测试\AD >c:\windows\temp\aad.txt
(for /l %%a in (1 1 1) do set /p ad1=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 2) do set /p ad2=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 3) do set /p ad3=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 4) do set /p ad4=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 5) do set /p ad5=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 6) do set /p ad6=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 7) do set /p ad7=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 8) do set /p ad8=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 9) do set /p ad9=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 10) do set /p ad10=)<c:\windows\temp\ad.txt
(for /l %%a in (1 1 1) do set /p aad1=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 2) do set /p aad2=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 3) do set /p aad3=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 4) do set /p aad4=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 5) do set /p aad5=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 6) do set /p aad6=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 7) do set /p aad7=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 8) do set /p aad8=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 9) do set /p aad9=)<c:\windows\temp\aad.txt
(for /l %%a in (1 1 10) do set /p aad10=)<c:\windows\temp\aad.txt
ren E:\测试\AD\%aad1% %ad1%
ren E:\测试\AD\%aad2% %ad2%
ren E:\测试\AD\%aad3% %ad3%
ren E:\测试\AD\%aad4% %ad4%
ren E:\测试\AD\%aad5% %ad5%
ren E:\测试\AD\%aad6% %ad6%
ren E:\测试\AD\%aad7% %ad7%
ren E:\测试\AD\%aad8% %ad8%
ren E:\测试\AD\%aad9% %ad9%
ren E:\测试\AD\%aad10% %ad10%
xcopy e:\测试\AD\*.* E:\测试\文件夹\ /y /h /r /k /s 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询