Advertisement
Imthedude025

Encode-Decode files.* to Base64 (Batch)

Jun 17th, 2018
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2. ::Encode-Decode file.* to Base64 ::
  3. ::Created by RU$$ [http://russdev.mooo.com/] ::
  4. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5. @ECHO OFF
  6. TITLE Encode-Decode file.* to Base64
  7. cd %~dp0
  8.  
  9. :MAIN
  10. cls
  11.  
  12. Echo Welcome to the Encode/Decode Base64 Menu!
  13. Echo 1. Encode an file to Base64
  14. Echo 2. Decode an file from Base64
  15. Echo 3. Exit
  16. Echo.
  17.  
  18. SET INPUT=
  19. SET /P INPUT= Please select an option:
  20.  
  21. IF /I '%INPUT%'=='1' GOTO :ENCODE
  22. IF /I '%INPUT%'=='2' GOTO :DECODE
  23. IF /I '%INPUT%'=='3' EXIT
  24.  
  25. goto :MAIN
  26.  
  27. :ENCODE
  28. cls
  29.  
  30. echo ::Files In This Directory::
  31. echo.
  32. dir /b /a-d
  33. echo.
  34.  
  35. Echo Select the file you wish to convert to text. (Must include extension)
  36. Set /p FILE=File Name:
  37.  
  38. If exist %FILE% (GOTO :EXISTS1) else (GOTO :ERROR1)
  39.  
  40. :EXISTS1
  41. cls
  42.  
  43. Echo STATUS: File was found, proceding with conversion.
  44. echo.
  45. certutil -encode %FILE% %FILE%.txt
  46. echo.
  47.  
  48. cls
  49. Echo STATUS: File was processed. Returning to MENU.
  50. echo.
  51. pause.
  52.  
  53. GOTO :MAIN
  54.  
  55. :ERROR1
  56. cls
  57.  
  58. Echo ERROR: File not found!
  59. Echo.
  60.  
  61. Pause.
  62. GOTO :ENCODE
  63.  
  64. :DECODE
  65. cls
  66. echo ::Text Files In This Directory::
  67. echo.
  68. dir /b /a-d *.txt
  69. echo.
  70.  
  71. Echo Select the text file you wish to convert from. (Must include extension)
  72. Set /p FILE=File Name:
  73.  
  74. If exist %FILE% (GOTO :EXISTS2) else (GOTO :ERROR2)
  75.  
  76. :EXISTS2
  77. cls
  78.  
  79. Echo STATUS: File was found, proceding with conversion.
  80. echo.
  81. SET FILE_EDIT=%FILE:.txt=%
  82. certutil -decode %FILE% %FILE_EDIT%
  83. GOTO :DEL
  84.  
  85. :DEL
  86. cls
  87. Echo STATUS: File was processed. Do you wish to del %FILE%?
  88. SET INPUT=
  89. SET /P INPUT= Delete file? (Y/N):
  90.  
  91. IF /I '%INPUT%'=='Y' DEL %FILE% && CLS && Echo File removed! && Echo. && Pause. && GOTO :MAIN
  92. IF /I '%INPUT%'=='y' DEL %FILE% && CLS && Echo File removed! && Echo. && Pause. && GOTO :MAIN
  93. IF /I '%INPUT%'=='N' CLS && Echo Returning to MENU. && Echo. && Pause. && GOTO :MAIN
  94. IF /I '%INPUT%'=='n' CLS && Echo Returning to MENU. && Echo. && Pause. && GOTO :MAIN
  95.  
  96. GOTO :DEL
  97.  
  98. :ERROR2
  99. cls
  100.  
  101. Echo ERROR: File not found!
  102. Echo.
  103.  
  104. Pause.
  105. GOTO :DECODE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement