脚本 - 批量修改后缀
::--------------------------------------------------------------------- rem 原有后缀后面加inf ::ren .\*.txt *.txt.inf ::ren .\dir1\*.txt *.txt.inf ::ren .\dir2\*.txt *.txt.inf ::ren .\dir2\dir22\*.txt *.txt.inf rem 清除上述增加的inf后缀 ::ren .\*.inf *. ::ren .\dir1\*.inf *. ::ren .\dir2\*.inf *. ::ren .\dir2\dir22\*.inf *. ::--------------------------------------------------------------------- rem 原有后缀后面加inf ::ren .\untitledClion_SDK2.0\include\*.h *.h.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf ::ren .\*.txt *.txt.inf rem 清除上述增加的inf后缀 ::ren .\*.inf *. ::ren .\dir1\*.inf *. ::ren .\dir2\*.inf *. ::ren .\dir2\dir22\*.inf *. ::--------------------------------------------------------------------- rem 删除目录下所有文件的后缀名 ::@echo off :: ::for /r .\test %%i in (*.inf) do ( ::echo "%%~fi" ::echo %%~ni ::ren "%%~fi" %%~ni ::) ::pause ::--------------------------------------------------------------------- @echo off set path_test=".\test" set path_SDK_include=".\untitledClion_SDK2.0\include" for /r %path_SDK_include% %%i in (*.h) do ( echo "%%~fi" echo "%%~ni".h.inf ren "%%~fi" "%%~ni".h.inf ) for /r %path_SDK_include% %%i in (*.hpp) do ( echo "%%~fi" echo "%%~ni".hpp.inf ren "%%~fi" "%%~ni".hpp.inf ) for /r %path_SDK_include% %%i in (*.cpp) do ( echo "%%~fi" echo "%%~ni".cpp.inf ren "%%~fi" "%%~ni".cpp.inf ) for /r %path_SDK_include% %%i in (*.inl) do ( echo "%%~fi" echo "%%~ni".inl.inf ren "%%~fi" "%%~ni".inl.inf ) set path_SDK_SDK=".\untitledClion_SDK2.0\SDK2.0" for /r %path_SDK_SDK% %%i in (*.h) do ( echo "%%~fi" echo "%%~ni".h.inf ren "%%~fi" "%%~ni".h.inf ) for /r %path_SDK_SDK% %%i in (*.hpp) do ( echo "%%~fi" echo "%%~ni".hpp.inf ren "%%~fi" "%%~ni".hpp.inf ) for /r %path_SDK_SDK% %%i in (*.cpp) do ( echo "%%~fi" echo "%%~ni".cpp.inf ren "%%~fi" "%%~ni".cpp.inf ) for /r %path_SDK_SDK% %%i in (*.inl) do ( echo "%%~fi" echo "%%~ni".inl.inf ren "%%~fi" "%%~ni".inl.inf ) set path_SDK_SDKTest=".\untitledClion_SDK2.0\SDK2.0Test" for /r %path_SDK_SDKTest% %%i in (*.h) do ( echo "%%~fi" echo "%%~ni".h.inf ren "%%~fi" "%%~ni".h.inf ) for /r %path_SDK_SDKTest% %%i in (*.hpp) do ( echo "%%~fi" echo "%%~ni".hpp.inf ren "%%~fi" "%%~ni".hpp.inf ) for /r %path_SDK_SDKTest% %%i in (*.cpp) do ( echo "%%~fi" echo "%%~ni".cpp.inf ren "%%~fi" "%%~ni".cpp.inf ) for /r %path_SDK_SDKTest% %%i in (*.inl) do ( echo "%%~fi" echo "%%~ni".inl.inf ren "%%~fi" "%%~ni".inl.inf ) set path_SDK=".\untitledClion_SDK2.0" for /r %path_SDK% %%i in (*.inf) do ( echo "%%~fi" echo "%%~ni" ren "%%~fi" "%%~ni" ) pause
::--------------------------------------------------------------------- rem 删除目录下所有文件的后缀名 ::@echo off :: ::for /r .\test %%i in (*.inf) do ( ::echo "%%~fi" ::echo %%~ni ::ren "%%~fi" %%~ni ::) ::pause ::--------------------------------------------------------------------- @echo off ::set path_SDK_include=".\SmartDevice" ::for /r %path_SDK_include% %%i in (*.h) do ( ::echo "%%~fi" ::echo "%%~ni".h.inf ::ren "%%~fi" "%%~ni".h.inf ::) ::for /r %path_SDK_include% %%i in (*.hpp) do ( ::echo "%%~fi" ::echo "%%~ni".hpp.inf ::ren "%%~fi" "%%~ni".hpp.inf ::) ::for /r %path_SDK_include% %%i in (*.cpp) do ( ::echo "%%~fi" ::echo "%%~ni".cpp.inf ::ren "%%~fi" "%%~ni".cpp.inf ::) ::for /r %path_SDK_include% %%i in (*.inl) do ( ::echo "%%~fi" ::echo "%%~ni".inl.inf ::ren "%%~fi" "%%~ni".inl.inf ::) ::for /r %path_SDK_include% %%i in (*.ui) do ( ::echo "%%~fi" ::echo "%%~ni".ui.inf ::ren "%%~fi" "%%~ni".ui.inf ::) :: ::set path_SDK_SDK=".\SmartDeviceTest" ::for /r %path_SDK_SDK% %%i in (*.h) do ( ::echo "%%~fi" ::echo "%%~ni".h.inf ::ren "%%~fi" "%%~ni".h.inf ::) ::for /r %path_SDK_SDK% %%i in (*.hpp) do ( ::echo "%%~fi" ::echo "%%~ni".hpp.inf ::ren "%%~fi" "%%~ni".hpp.inf ::) ::for /r %path_SDK_SDK% %%i in (*.cpp) do ( ::echo "%%~fi" ::echo "%%~ni".cpp.inf ::ren "%%~fi" "%%~ni".cpp.inf ::) ::for /r %path_SDK_SDK% %%i in (*.inl) do ( ::echo "%%~fi" ::echo "%%~ni".inl.inf ::ren "%%~fi" "%%~ni".inl.inf ::) ::for /r %path_SDK_SDK% %%i in (*.ui) do ( ::echo "%%~fi" ::echo "%%~ni".ui.inf ::ren "%%~fi" "%%~ni".ui.inf ::) ::set path_SDK_1=".\SmartDevice" ::for /r %path_SDK_1% %%i in (*.inf) do ( ::echo "%%~fi" ::echo "%%~ni" ::ren "%%~fi" "%%~ni" ::) ::set path_SDK_2=".\SmartDeviceTest" ::for /r %path_SDK_2% %%i in (*.inf) do ( ::echo "%%~fi" ::echo "%%~ni" ::ren "%%~fi" "%%~ni" ::) set path_include=".\CL2.0" ::+++ ::for /r %path_include% %%i in (*.*) do ( ::echo "%%~fi" ::echo "%%~ni".*.inf ::ren "%%~fi" "%%~ni".*.inf ::) ::for /r %path_include% %%i in (*.hpp) do ( ::echo "%%~fi" ::echo "%%~ni".hpp.inf ::ren "%%~fi" "%%~ni".hpp.inf ::) ::for /r %path_include% %%i in (*.cpp) do ( ::echo "%%~fi" ::echo "%%~ni".cpp.inf ::ren "%%~fi" "%%~ni".cpp.inf ::) ::for /r %path_include% %%i in (*.inl) do ( ::echo "%%~fi" ::echo "%%~ni".inl.inf ::ren "%%~fi" "%%~ni".inl.inf ::) ::for /r %path_include% %%i in (*.ui) do ( ::echo "%%~fi" ::echo "%%~ni".ui.inf ::ren "%%~fi" "%%~ni".ui.inf ::) ::--- for /r %path_include% %%i in (*.inf) do ( echo "%%~fi" echo "%%~ni" ren "%%~fi" "%%~ni" ) pause
博客园文作者:Citrusliu
博文地址:https://www.cnblogs.com/citrus