谢谢老师!!
代码如下:
@echo off
setlocal enabledelayedexpansion
for %%a in (*.txt) do set "txt=%%a" & call :aa
pause
:aa
for /f "usebackq delims=*" %%b in ("!txt!") do (
set "a=%%a" & set "b=%%b"
ren "!a!" "!b!.txt"
goto :eof
)作者: ShowCode 时间: 2017-4-10 10:30
@echo off
setlocal enabledelayedexpansion
for %%a in (*.txt) do set "txt=%%a" & call :aa
pause
:aa
for /f "usebackq delims=*" %%b in ("!txt!") do (
set "a=%%a" & set "b=%%b"
)
ren "!a!" "!b!.txt"
goto :eof作者: 屡败屡战 时间: 2017-4-10 10:42
@echo on
setlocal enabledelayedexpansion
for %%a in (*.txt) do set "txt=%%a" & call :aa
pause
:aa
for /f "usebackq delims=*" %%b in ("!txt!") do (
set "a=%%a" & set "b=%%b"
)
echo +++ "!a!" "!b!.txt"
if exist "!b!.txt" (
echo --- 重复
) else (
ren "!a!" "!b!.txt"
)
goto :eof
请问你后面改好的代码是这样 的吗?
@echo on
setlocal enabledelayedexpansion
for %%a in (*.txt) do set "txt=%%a" & call :aa&&ren "%%~fa" "!b::=!%%~xa"
pause
:aa
for /f "usebackq delims=*" %%b in ("!txt!") do (
set "a=%%a" & set "b=%%b"
)
echo +++ "!a!" "!b!.txt"
if exist "!b!.txt" (
echo --- 重复
) else (