Advertisement
hidde663

explorer.bat

Jan 17th, 2018
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.50 KB | None | 0 0
  1. @echo off&setlocal enabledelayedexpansion
  2. set maxdisplayeditems=59
  3. set hide=1
  4. set firstnumber=1
  5. set savedcnt3=
  6. ::version 29-may-2018
  7. ::updates will be posted to https://pastebin.com/yWuMdiep
  8. :opendir
  9. set cnt=0
  10. set cnt1=0
  11. set dircount=0
  12. set filecount=0
  13. for /f "tokens=*" %%a in ('dir/AD/B/OGN') do set/a dircount+=1
  14. for /f "tokens=*" %%a in ('dir/A-D/B/OGN') do set/a filecount+=1
  15. cls
  16. set/a cnt=!dircount!+!filecount!
  17. :opendirloop
  18. if "!dircount!" GTR "0" for /f "tokens=*" %%a in ('dir/AD/B/OGN') do set/a cnt1+=1&set str!cnt1!=[%%a]&set/a dircount-=1
  19. if "!filecount!" GTR "0" for /f "tokens=*" %%a in ('dir/A-D/B/OGN') do set/a cnt1+=1&set "str!cnt1!=%%a"&set/a filecount-=1
  20. if '!cnt!'=='!cnt1!' (goto fill) else goto opendirloop
  21. :fill
  22. set cnt2=1
  23. for /l %%a in (1,1,!cnt!) do (
  24. set/a cnt2+=1
  25. set arr%%a=ÿ
  26. )
  27. set cnt3=1
  28. if not "!savedcnt3!"=="" set cnt3=!savedcnt3!
  29. set savedcnt3=
  30. set "arr!cnt3!=þ"
  31. :screen
  32. cls
  33. if !hide! EQU 0 (
  34. echo Use W^(up^), S^(down^) to move the pointer
  35. echo Use D to open the selected file^(with the default program^)/directory
  36. echo Use A to go back a directory
  37. echo Use E^(xecute^) to open file with a specific program
  38. echo Use N^(reName^) to rename a file/directory
  39. echo Use P^(rompt^) to run a command
  40. echo Use C^(opy^) to copy a file/directory
  41. echo Use V to paste a file/directory
  42. echo Use M^(ore^)/L^(ess^) to for +/- maxdisplayeditems
  43. echo Use R^(emove^) to delete an file or directory
  44. echo Use I^(nfo^) to show file/dir info
  45. )
  46. echo Use H^(ide^) to show/hide input commands
  47. if !cnt3! LSS !firstnumber! if !cnt3! GEQ 1 set/a maxdisplayeditems-=1&set/a firstnumber-=1
  48. if !cnt3! LSS 1 (
  49. set "arr!cnt3!=ÿ"
  50. set/a cnt3+=1
  51. set "arr!cnt3!=þ"
  52. )
  53. if !cnt3! GTR !maxdisplayeditems! if !cnt3! LEQ !cnt! set/a maxdisplayeditems+=1&set/a firstnumber+=1
  54. if !cnt3! GTR !cnt! (
  55. set "arr!cnt3!=ÿ"
  56. set/a cnt3-=1
  57. set "arr!cnt3!=þ"
  58. )
  59. if !cnt! GEQ !maxdisplayeditems! (set pagelenght=!maxdisplayeditems!) else set pagelenght=!cnt!
  60. if not !firstnumber! EQU 1 set/a temp2=!firstnumber!-1
  61. if !firstnumber! GTR 1 (echo --!temp2! more--) else echo.
  62. for /l %%a in (!firstnumber!,1,!pagelenght!) do (
  63. echo !arr%%a! !str%%a!
  64. )
  65. set/a temp3=!cnt!-!maxdisplayeditems!
  66. if !cnt! GTR !maxdisplayeditems! echo --!temp3! more--
  67. choice /c wsenpdacvhmlri /n>nul
  68. if !errorlevel!==1 (
  69. set "arr!cnt3!=ÿ"
  70. set/a cnt3-=1
  71. set "arr!cnt3!=þ"
  72. goto screen
  73. )
  74. if !errorlevel!==2 (
  75. set "arr!cnt3!=ÿ"
  76. set/a cnt3+=1
  77. set "arr!cnt3!=þ"
  78. goto screen
  79. )
  80. if !errorlevel!==3 (
  81. cls&set /p "program=open "!str%cnt3%!" with program:"
  82. if "!program!"=="" cls&echo an error has occured&pause>nul&goto opendir
  83. set "check=!str%cnt3%!"
  84. if '!check!'=='%check:.=%' (
  85. for /f %%a in ('dir/A-D/B ^| findstr "!check!"') do (
  86. set "check=%%a"
  87. )
  88. )
  89. if exist "!check!" (
  90. "!program!" "!check!"
  91. ) else (
  92. cls&echo ERROR: File not found&pause>nul
  93. )
  94. goto screen
  95. )
  96. if !errorlevel!==4 (
  97. echo.
  98. echo rename !str%cnt3%! to what?
  99. set/p newname=
  100. ren "!str%cnt3%!" "!newname!"
  101. set savedcnt3=!cnt3!
  102. )
  103. if !errorlevel!==5 (
  104. set "command="
  105. cls&set/p command=Type your command:
  106. if not "!command!"=="" !command!
  107. goto opendir
  108. )
  109. if !errorlevel!==6 (
  110. pushd "!str%cnt3%:~1,-1!" 2>nul
  111. if !errorlevel!==1 start "" "!str%cnt3%!"&goto screen
  112. for /l %%a in (%cnt%,-1,1) do (
  113. set "str%%a="
  114. )
  115. )
  116. if !errorlevel!==7 (
  117. pushd ..
  118. for /l %%a in (%cnt%,-1,1) do (
  119. set "str%%a="
  120. )
  121. )
  122. if !errorlevel!==8 (
  123. if "[!str%cnt3%:~1,-1!]"=="!str%cnt3%!" (
  124. set "filetocopy=%CD%\!str%cnt3%:~1,-1!"
  125. set "filename=!str%cnt3%:~1,-1!"
  126. ) else (
  127. set "filetocopy=%CD%\!str%cnt3%!"
  128. set "filename=!str%cnt3%!"
  129. )
  130. goto screen
  131. )
  132. if !errorlevel!==9 (
  133. if not exist "%CD%\%filename%" (
  134. copy "%filetocopy%" "%CD%"
  135. ) else (
  136. if not exist "%CD%\%filename% - Copy" (
  137. set "olddir=%CD%"
  138. copy "%filetocopy%" "%temp%" >nul
  139. pushd "%temp%"
  140. for /f "tokens=1,2 delims=." %%a in ('dir/b ^| findstr "%filename%"') do (
  141. ren "%filename%" "%%a - Copy.%%b" >nul
  142. move "%%a - Copy.%%b" "!olddir!" >nul
  143. popd
  144. set savedcnt3=!cnt3!
  145. goto opendir
  146. )
  147. )
  148. )
  149. )
  150. if !errorlevel!==10 (
  151. if !hide! EQU 0 (
  152. set hide=1
  153. set/a maxdisplayeditems+=11
  154. ) else (
  155. set hide=0
  156. set/a maxdisplayeditems-=11
  157. set pagelenght-=11
  158. if !cnt3! GTR !maxdisplayeditems! (
  159. set arr!cnt3!=ÿ
  160. set cnt3=!maxdisplayeditems!
  161. set arr!cnt3!=þ
  162. )
  163. )
  164. goto screen
  165. )
  166. if !errorlevel!==11 (
  167. if !cnt! GTR !maxdisplayeditems! (
  168. set/a maxdisplayeditems+=1
  169. ) else (
  170. if !firstnumber! GTR 1 set/a firstnumber-=1&set pagelenght+=1&set/a maxdisplayeditems+=1
  171. )
  172. goto screen
  173. )
  174. if !errorlevel!==12 (
  175. if !maxdisplayeditems! GTR !cnt3! (
  176. set/a maxdisplayeditems-=1
  177. set pagelenght-=1
  178. )
  179. goto screen
  180. )
  181. if !errorlevel!==13 (
  182. if "[!str%cnt3%:~1,-1!]"=="!str%cnt3%!" (
  183. cls&echo Are you sure you want to delete "!str%cnt3%:~1,-1!"?
  184. choice
  185. if !errorlevel!==1 rmdir "!str%cnt3%:~1,-1!"
  186. if !errorlevel!==2 echo "!str%cnt3%:~1,-1!" was not removed&timeout 2 >nul&goto screen
  187. ) else (
  188. cls&echo Are you sure you want to delete "!str%cnt3%!"?
  189. choice
  190. if !errorlevel!==1 del "!str%cnt3%!"&set/a savedcnt3=!cnt3!-1
  191. if !errorlevel!==1 echo "!str%cnt3%!" was not removed&timeout 2 >nul&goto screen
  192. )
  193. )
  194. if "!errorlevel!"=="14" (
  195. cls
  196. for /f "tokens=1-4" %%a in ('dir/A-D ^| find "!str%cnt3%!"') do echo File-info: [%%a %%b] %%d [%%c bytes]
  197. for /f "tokens=1-4" %%a in ('dir/AD ^| find "!str%cnt3%:~1,-1!"') do echo Dir-info: [%%a %%b] %%d [%%c]
  198. pause>nul
  199. )
  200. goto opendir
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement