The code is as follows:
@echo off
:0
cls
echo.
echo. ╭────────╮
echo. ╭────┤ Usage Instructions ├────╮
echo. │ ╰────────╯ │
echo. │ │
echo. │ 1、The purpose of this tool is - batch modify files with specified suffixes in the specified directory to other specified suffixes. │
echo. │ │
echo. │ 2、Please press Enter after each input! │
echo. │ │
echo. │ 3、Note - only enter the suffix, do not enter the "." before the suffix │
echo. │ │
echo. │ 4、If there are spaces and special characters in the folder path, please type it in manually, do not drag and drop! │
echo. │ │
echo. ╰──────────────────╯
echo.&echo Please enter the path of the folder, or drag and drop the folder to this window
set LJ=
set /p LJ=
if /i "%LJ%"=="" goto 0
echo.&echo Please enter the original suffix name:
set q=
set /p q=
if /i "%q%"=="" goto 0
echo.&echo Please enter the new suffix name:
set h=
set /p h=
if /i "%h%"=="" goto 0
cd %LJ%
REN *.%q% *.%h%
echo.&echo. Suffix names have been batch modified successfully!
echo.&echo. Please open the folder and take a look!
start %LJ%
pause
goto 0
This batch processing is my original work and is basically successful.
The questions are -
1、When there are spaces and special characters in the folder path, how to support drag and drop?
2、If you want to process all subdirectories under the folder at the same time, how to write it?
3、In order to avoid being detected, I also want to go further: "While batch modifying the suffix name, batch modify the file name".
That is - add a number 1 between the first character and the second character of the file name.
How to write this?
4、For example, I want to change all "*.cpl" files in "C:\WINDOWS\system32" to "all suffix names uniformly changed to bbb, and a number 1 is added between the first character and the second character of the file name".
In this case, how to write the batch processing to restore the original file name and suffix?
Looking forward to the expert's answer!
Thanks in advance!!!
Kowtow......
@echo off
:0
cls
echo.
echo. ╭────────╮
echo. ╭────┤ Usage Instructions ├────╮
echo. │ ╰────────╯ │
echo. │ │
echo. │ 1、The purpose of this tool is - batch modify files with specified suffixes in the specified directory to other specified suffixes. │
echo. │ │
echo. │ 2、Please press Enter after each input! │
echo. │ │
echo. │ 3、Note - only enter the suffix, do not enter the "." before the suffix │
echo. │ │
echo. │ 4、If there are spaces and special characters in the folder path, please type it in manually, do not drag and drop! │
echo. │ │
echo. ╰──────────────────╯
echo.&echo Please enter the path of the folder, or drag and drop the folder to this window
set LJ=
set /p LJ=
if /i "%LJ%"=="" goto 0
echo.&echo Please enter the original suffix name:
set q=
set /p q=
if /i "%q%"=="" goto 0
echo.&echo Please enter the new suffix name:
set h=
set /p h=
if /i "%h%"=="" goto 0
cd %LJ%
REN *.%q% *.%h%
echo.&echo. Suffix names have been batch modified successfully!
echo.&echo. Please open the folder and take a look!
start %LJ%
pause
goto 0
This batch processing is my original work and is basically successful.
The questions are -
1、When there are spaces and special characters in the folder path, how to support drag and drop?
2、If you want to process all subdirectories under the folder at the same time, how to write it?
3、In order to avoid being detected, I also want to go further: "While batch modifying the suffix name, batch modify the file name".
That is - add a number 1 between the first character and the second character of the file name.
How to write this?
4、For example, I want to change all "*.cpl" files in "C:\WINDOWS\system32" to "all suffix names uniformly changed to bbb, and a number 1 is added between the first character and the second character of the file name".
In this case, how to write the batch processing to restore the original file name and suffix?
Looking forward to the expert's answer!
Thanks in advance!!!
Kowtow......


