GL1TCH3D

GL1TCH3D's Extension Tool

Jul 15th, 2015
485
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.79 KB | None | 0 0
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. title GL1TCH3D's Extension Tool
  4.  
  5. set num=0
  6.  
  7. :ext0
  8.  
  9. Echo What extension would you like to add (do not include the .)?
  10.  
  11. set /p ext%num%=-^>
  12.  
  13. call :check1
  14.  
  15. :ext
  16.  
  17. Echo What extension would you like to remove (do not include the .)?
  18.  
  19. set /p ext%num%=-^>
  20.  
  21. if /i not "%check%"=="none" set /a num-=1 &goto none
  22.  
  23. call :check1
  24.  
  25. cls
  26.  
  27. Echo Add extensions to files with no extensions? (Y/N)
  28.  
  29. set /p check=-^>
  30.  
  31. if /i not "%check%"=="N" goto none
  32.  
  33. :replace
  34. cls
  35. Echo Replacing the following extensions with %ext0%:
  36.  
  37. For /l %%a in (1,1,%num%) do (
  38. if "!ext%%a!"=="" echo empty &goto pause
  39. echo !ext%%a!
  40. )
  41.  
  42. :pause
  43. echo Press any key to continue
  44.  
  45. pause > nul
  46. CLS
  47. set cur=1
  48. set dot=.
  49.  
  50. :restart
  51. if "!ext%cur%!"=="" set dot=
  52. for /f "tokens=1,2 delims=." %%g in ('dir /b /a:-d "!cd!"') do (
  53. if "%%h"=="!ext%cur%!" rename %%g!dot!%%h %%g.!ext0!
  54. if "%%h"=="!ext%cur%!" echo %%g!dot!%%h to %%g.!ext0!>>log.log
  55. )
  56. if "%cur%"=="%num%" goto finish
  57.  
  58. set /a cur+=1
  59.  
  60. goto restart
  61.  
  62. :finish
  63. cls
  64. echo Files successfully renamed!
  65. echo Press any key to close the program.
  66. pause>nul
  67. exit
  68.  
  69. :check1
  70.  
  71. for /l %%a in (1,1,10000) do (
  72. set inp1=!ext%num%:~%%a,1!
  73. if "!inp1!"=="." goto error
  74. if not defined inp1 goto end
  75. )
  76. :end
  77.  
  78. :check2
  79. echo Is "!ext%num%!" correct? (Y/N)
  80.  
  81. set /p check=-^>
  82.  
  83. if /i not "%check%"=="Y" goto No
  84. if %num%==0 set /a num+=1 &exit /b
  85.  
  86. cls
  87. :check3
  88. Echo Would you like to replace more extensions? (Y/N)
  89.  
  90. set /p check=-^>
  91.  
  92. if /i not %check%==N set /a num+=1 & goto ext
  93.  
  94. exit /b
  95.  
  96. :error
  97.  
  98. Echo Please do not add the "."
  99. Echo Press any key to try again &
  100. Pause > nul
  101. if %num%==0 goto ext0
  102. goto ext
  103.  
  104. :No
  105. CLS
  106. if %num%==0 goto ext0
  107. goto ext
  108.  
  109. :none
  110. set none=Yes
  111. set /a num+=1
  112. set ext%num%=
  113. goto replace
Advertisement
Add Comment
Please, Sign In to add comment