Batch converting BAT format files to TXT format (batch renaming extensions)
Function: Batch convert BAT and CMD format batch files in the current directory to TXT format.
Purpose: Suitable for converting batch files and placing them on a mobile phone to view as TXT e-books. Since it is cumbersome to manually change the extensions when there are many files, I thought of using P to handle it. Here is the code:
The above code is not concise. Please provide a better solution. Try to make the code concise and user-friendly. It is best to add a function to restore to the original state after conversion. Of course, a backup function is even better. I hope experts can add some personalized functions such as adding a progress bar, displaying progress, and displaying processing details to make it more user-friendly. Thank you! Because my DOS is very shallow, I feel difficult even to solve small problems. Thank you.
[ Last edited by Batain on 2008-5-17 at 02:25 PM ]
Function: Batch convert BAT and CMD format batch files in the current directory to TXT format.
Purpose: Suitable for converting batch files and placing them on a mobile phone to view as TXT e-books. Since it is cumbersome to manually change the extensions when there are many files, I thought of using P to handle it. Here is the code:
@echo off
title bat2txt
echo Renaming all BAT files in the current directory to TXT
for /f "delims=" %%i in ('dir /b /l /a-d ^| findstr ".cmd$" ^& dir /b /a-d ^| findstr /i ".bat$"') do (
if not "%%~nxi"=="%~nx0" (
ren "%%~nxi" "%%~ni.txt" 2>nul || echo Ignored the operation on "%%i", there is "%%~ni.txt" in this directory
)
)
pause
The above code is not concise. Please provide a better solution. Try to make the code concise and user-friendly. It is best to add a function to restore to the original state after conversion. Of course, a backup function is even better. I hope experts can add some personalized functions such as adding a progress bar, displaying progress, and displaying processing details to make it more user-friendly. Thank you! Because my DOS is very shallow, I feel difficult even to solve small problems. Thank you.
[ Last edited by Batain on 2008-5-17 at 02:25 PM ]
拙拙的跟各位学习学习,增长学问。



do (