本帖最后由 yunyan100 于 2019-1-12 17:33 编辑
感谢你们好,路径长度不确定,有根目录到下面若干,5楼9个基本可以但可能超过,我改下但不适用- for /f %%a in ('findstr/n ".*" 1.txt^|sort/r') do (
- set "pa=%%a"
- setlocal enabledelayedexpansion
- set "pa=!pa:"=!"
- echo "!pa:*:=!")>>1.txt&endlocal
- pause
复制代码 我下面发的是我在用,只是目前改进.文件夹或文件,要删除有"()&",通过"cd.."路径都可以- cd /d "%pa%" >nul 2>nul
- :uacc
- for %%a in ("%cd%") do echo %%a>>%dp%\1.txt
- dir/ad "%cd%\" >nul 2>nul&&cd..&&goto :uacc
- for /f "delims=" %%a in (%dp%\1.txt) do (setlocal enabledelayedexpansion&for %%i in (%%a) do (set "pay=%%~nxi"
- set "pay=!pay:(=!"
- set "pay=!pay:)=!"
- set "pay=!pay:&=!"
- set "pay=!pay: =!"
- ren %%i "!pay!" >nul 2>nul))&endlocal&del %dp%\1.txt >nul 2>nul
- if "%ee%"=="e" set "pac=%pa%"
- if "%ee%"=="e" set "pa=%pa%\%paa%"
- if "%ee%"=="e" set "paa=%paa:&=%"
- if "%ee%"=="e" set "paa=%paa:(=%"
- if "%ee%"=="e" set "paa=%paa:)=%"
- if "%ee%"=="e" ren "%pa%" "%paa%"
复制代码
|