代码拉取完成,页面将自动刷新
@echo off
setlocal enabledelayedexpansion
:: 获取脚本所在的目录
set "scriptDir=%~dp0"
:: 检查是否有 .ttml 文件存在
set "foundFiles=0"
for /r "%scriptDir%" %%f in (*.ttml) do (
set /a foundFiles+=1
)
if %foundFiles% equ 0 (
echo No .ttml files found in the directory and its subdirectories.
pause
exit /b
)
:: 递归遍历脚本所在目录及其子目录中的所有 .ttml 文件
for /r "%scriptDir%" %%f in (*.ttml) do (
set "fullPath=%%f"
set "newPath=%%~dpnf.wxml" :: 构造新的路径和文件名(去掉原来的.ttml扩展名)
:: 输出调试信息
echo Processing file: %%f
echo New name will be: !newPath!
:: 检查新文件名是否已经存在,避免覆盖
if not exist "!newPath!" (
ren "%%f" "%%~nxf:~0,-5.wxml" :: 去掉原扩展名再添加新扩展名 (.ttml是5个字符)
if errorlevel 1 (
echo Failed to rename: "%%f"
) else (
echo Renamed: "%%f" to "%%~nxf:~0,-5.wxml"
)
) else (
echo Skipped renaming: "%%f" because "!newPath!" already exists.
)
)
endlocal
pause
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。