Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enabledelayedexpansion
- title GL1TCH3D's Extension Tool
- set num=0
- :ext0
- Echo What extension would you like to add (do not include the .)?
- set /p ext%num%=-^>
- call :check1
- :ext
- Echo What extension would you like to remove (do not include the .)?
- set /p ext%num%=-^>
- if /i not "%check%"=="none" set /a num-=1 &goto none
- call :check1
- cls
- Echo Add extensions to files with no extensions? (Y/N)
- set /p check=-^>
- if /i not "%check%"=="N" goto none
- :replace
- cls
- Echo Replacing the following extensions with %ext0%:
- For /l %%a in (1,1,%num%) do (
- if "!ext%%a!"=="" echo empty &goto pause
- echo !ext%%a!
- )
- :pause
- echo Press any key to continue
- pause > nul
- CLS
- set cur=1
- set dot=.
- :restart
- if "!ext%cur%!"=="" set dot=
- for /f "tokens=1,2 delims=." %%g in ('dir /b /a:-d "!cd!"') do (
- if "%%h"=="!ext%cur%!" rename %%g!dot!%%h %%g.!ext0!
- if "%%h"=="!ext%cur%!" echo %%g!dot!%%h to %%g.!ext0!>>log.log
- )
- if "%cur%"=="%num%" goto finish
- set /a cur+=1
- goto restart
- :finish
- cls
- echo Files successfully renamed!
- echo Press any key to close the program.
- pause>nul
- exit
- :check1
- for /l %%a in (1,1,10000) do (
- set inp1=!ext%num%:~%%a,1!
- if "!inp1!"=="." goto error
- if not defined inp1 goto end
- )
- :end
- :check2
- echo Is "!ext%num%!" correct? (Y/N)
- set /p check=-^>
- if /i not "%check%"=="Y" goto No
- if %num%==0 set /a num+=1 &exit /b
- cls
- :check3
- Echo Would you like to replace more extensions? (Y/N)
- set /p check=-^>
- if /i not %check%==N set /a num+=1 & goto ext
- exit /b
- :error
- Echo Please do not add the "."
- Echo Press any key to try again &
- Pause > nul
- if %num%==0 goto ext0
- goto ext
- :No
- CLS
- if %num%==0 goto ext0
- goto ext
- :none
- set none=Yes
- set /a num+=1
- set ext%num%=
- goto replace
Advertisement
Add Comment
Please, Sign In to add comment