Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off&setlocal enabledelayedexpansion
- set maxdisplayeditems=59
- set hide=1
- set firstnumber=1
- set savedcnt3=
- ::version 29-may-2018
- ::updates will be posted to https://pastebin.com/yWuMdiep
- :opendir
- set cnt=0
- set cnt1=0
- set dircount=0
- set filecount=0
- for /f "tokens=*" %%a in ('dir/AD/B/OGN') do set/a dircount+=1
- for /f "tokens=*" %%a in ('dir/A-D/B/OGN') do set/a filecount+=1
- cls
- set/a cnt=!dircount!+!filecount!
- :opendirloop
- 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
- 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
- if '!cnt!'=='!cnt1!' (goto fill) else goto opendirloop
- :fill
- set cnt2=1
- for /l %%a in (1,1,!cnt!) do (
- set/a cnt2+=1
- set arr%%a=ÿ
- )
- set cnt3=1
- if not "!savedcnt3!"=="" set cnt3=!savedcnt3!
- set savedcnt3=
- set "arr!cnt3!=þ"
- :screen
- cls
- if !hide! EQU 0 (
- echo Use W^(up^), S^(down^) to move the pointer
- echo Use D to open the selected file^(with the default program^)/directory
- echo Use A to go back a directory
- echo Use E^(xecute^) to open file with a specific program
- echo Use N^(reName^) to rename a file/directory
- echo Use P^(rompt^) to run a command
- echo Use C^(opy^) to copy a file/directory
- echo Use V to paste a file/directory
- echo Use M^(ore^)/L^(ess^) to for +/- maxdisplayeditems
- echo Use R^(emove^) to delete an file or directory
- echo Use I^(nfo^) to show file/dir info
- )
- echo Use H^(ide^) to show/hide input commands
- if !cnt3! LSS !firstnumber! if !cnt3! GEQ 1 set/a maxdisplayeditems-=1&set/a firstnumber-=1
- if !cnt3! LSS 1 (
- set "arr!cnt3!=ÿ"
- set/a cnt3+=1
- set "arr!cnt3!=þ"
- )
- if !cnt3! GTR !maxdisplayeditems! if !cnt3! LEQ !cnt! set/a maxdisplayeditems+=1&set/a firstnumber+=1
- if !cnt3! GTR !cnt! (
- set "arr!cnt3!=ÿ"
- set/a cnt3-=1
- set "arr!cnt3!=þ"
- )
- if !cnt! GEQ !maxdisplayeditems! (set pagelenght=!maxdisplayeditems!) else set pagelenght=!cnt!
- if not !firstnumber! EQU 1 set/a temp2=!firstnumber!-1
- if !firstnumber! GTR 1 (echo --!temp2! more--) else echo.
- for /l %%a in (!firstnumber!,1,!pagelenght!) do (
- echo !arr%%a! !str%%a!
- )
- set/a temp3=!cnt!-!maxdisplayeditems!
- if !cnt! GTR !maxdisplayeditems! echo --!temp3! more--
- choice /c wsenpdacvhmlri /n>nul
- if !errorlevel!==1 (
- set "arr!cnt3!=ÿ"
- set/a cnt3-=1
- set "arr!cnt3!=þ"
- goto screen
- )
- if !errorlevel!==2 (
- set "arr!cnt3!=ÿ"
- set/a cnt3+=1
- set "arr!cnt3!=þ"
- goto screen
- )
- if !errorlevel!==3 (
- cls&set /p "program=open "!str%cnt3%!" with program:"
- if "!program!"=="" cls&echo an error has occured&pause>nul&goto opendir
- set "check=!str%cnt3%!"
- if '!check!'=='%check:.=%' (
- for /f %%a in ('dir/A-D/B ^| findstr "!check!"') do (
- set "check=%%a"
- )
- )
- if exist "!check!" (
- "!program!" "!check!"
- ) else (
- cls&echo ERROR: File not found&pause>nul
- )
- goto screen
- )
- if !errorlevel!==4 (
- echo.
- echo rename !str%cnt3%! to what?
- set/p newname=
- ren "!str%cnt3%!" "!newname!"
- set savedcnt3=!cnt3!
- )
- if !errorlevel!==5 (
- set "command="
- cls&set/p command=Type your command:
- if not "!command!"=="" !command!
- goto opendir
- )
- if !errorlevel!==6 (
- pushd "!str%cnt3%:~1,-1!" 2>nul
- if !errorlevel!==1 start "" "!str%cnt3%!"&goto screen
- for /l %%a in (%cnt%,-1,1) do (
- set "str%%a="
- )
- )
- if !errorlevel!==7 (
- pushd ..
- for /l %%a in (%cnt%,-1,1) do (
- set "str%%a="
- )
- )
- if !errorlevel!==8 (
- if "[!str%cnt3%:~1,-1!]"=="!str%cnt3%!" (
- set "filetocopy=%CD%\!str%cnt3%:~1,-1!"
- set "filename=!str%cnt3%:~1,-1!"
- ) else (
- set "filetocopy=%CD%\!str%cnt3%!"
- set "filename=!str%cnt3%!"
- )
- goto screen
- )
- if !errorlevel!==9 (
- if not exist "%CD%\%filename%" (
- copy "%filetocopy%" "%CD%"
- ) else (
- if not exist "%CD%\%filename% - Copy" (
- set "olddir=%CD%"
- copy "%filetocopy%" "%temp%" >nul
- pushd "%temp%"
- for /f "tokens=1,2 delims=." %%a in ('dir/b ^| findstr "%filename%"') do (
- ren "%filename%" "%%a - Copy.%%b" >nul
- move "%%a - Copy.%%b" "!olddir!" >nul
- popd
- set savedcnt3=!cnt3!
- goto opendir
- )
- )
- )
- )
- if !errorlevel!==10 (
- if !hide! EQU 0 (
- set hide=1
- set/a maxdisplayeditems+=11
- ) else (
- set hide=0
- set/a maxdisplayeditems-=11
- set pagelenght-=11
- if !cnt3! GTR !maxdisplayeditems! (
- set arr!cnt3!=ÿ
- set cnt3=!maxdisplayeditems!
- set arr!cnt3!=þ
- )
- )
- goto screen
- )
- if !errorlevel!==11 (
- if !cnt! GTR !maxdisplayeditems! (
- set/a maxdisplayeditems+=1
- ) else (
- if !firstnumber! GTR 1 set/a firstnumber-=1&set pagelenght+=1&set/a maxdisplayeditems+=1
- )
- goto screen
- )
- if !errorlevel!==12 (
- if !maxdisplayeditems! GTR !cnt3! (
- set/a maxdisplayeditems-=1
- set pagelenght-=1
- )
- goto screen
- )
- if !errorlevel!==13 (
- if "[!str%cnt3%:~1,-1!]"=="!str%cnt3%!" (
- cls&echo Are you sure you want to delete "!str%cnt3%:~1,-1!"?
- choice
- if !errorlevel!==1 rmdir "!str%cnt3%:~1,-1!"
- if !errorlevel!==2 echo "!str%cnt3%:~1,-1!" was not removed&timeout 2 >nul&goto screen
- ) else (
- cls&echo Are you sure you want to delete "!str%cnt3%!"?
- choice
- if !errorlevel!==1 del "!str%cnt3%!"&set/a savedcnt3=!cnt3!-1
- if !errorlevel!==1 echo "!str%cnt3%!" was not removed&timeout 2 >nul&goto screen
- )
- )
- if "!errorlevel!"=="14" (
- cls
- for /f "tokens=1-4" %%a in ('dir/A-D ^| find "!str%cnt3%!"') do echo File-info: [%%a %%b] %%d [%%c bytes]
- for /f "tokens=1-4" %%a in ('dir/AD ^| find "!str%cnt3%:~1,-1!"') do echo Dir-info: [%%a %%b] %%d [%%c]
- pause>nul
- )
- goto opendir
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement