不要解释代码
时间: 2023-07-02 10:21:22 浏览: 128
好的,我明白了。你的问题是:
用Windows脚本实现自动获取当前路径后自定义查找的三种类型和自定义三种文件夹名称;实现在当前目录下遍历查找符合类型的文件复制到自定义的文件后再把自定义的文件夹和里面的内容移动到指定的文件夹内。
以下是实现该功能的代码:
```
@echo off
setlocal enabledelayedexpansion
set currentPath=%cd%
set type1=txt
set type2=doc
set type3=pdf
set folder1=folder1
set folder2=folder2
set folder3=folder3
for /r "%currentPath%" %%i in (*.%type1% *.%type2% *.%type3%) do (
if not exist "%currentPath%\%folder1%" mkdir "%currentPath%\%folder1%"
if not exist "%currentPath%\%folder2%" mkdir "%currentPath%\%folder2%"
if not exist "%currentPath%\%folder3%" mkdir "%currentPath%\%folder3%"
if "%%~xi"==".%type1%" copy "%%i" "%currentPath%\%folder1%\"
if "%%~xi"==".%type2%" copy "%%i" "%currentPath%\%folder2%\"
if "%%~xi"==".%type3%" copy "%%i" "%currentPath%\%folder3%\"
)
if not exist "%currentPath%\destination" mkdir "%currentPath%\destination"
move "%currentPath%\%folder1%" "%currentPath%\destination\"
move "%currentPath%\%folder2%" "%currentPath%\destination\"
move "%currentPath%\%folder3%" "%currentPath%\destination\"
endlocal
```
希望这个代码可以帮助到你。
阅读全文