explorer.bat to replace explorer.exe


By: hidde663
January 24, 2018

Have you ever wanted to run windows with just a console, but couldnt because it would be a pain to find files, folders, etc?

Well now you can with explorer.bat

features:

-use w/s to move up & down
-open files with your specific program
-run any command as if it is not a .bat file
-open the directory that you have selected with the pointer
-one click goto upper directory
-copy a file & paste it (allows for switching directories before pasting)
-only allows up to 74 items on screen(can be changed by setting maxdisplayeditems to something else than 74)
-updates in the future

best looking setup:

run explorer.bat with cmd.exe (cmder.exe looks better but you'll have to download it)
rightclick your taskbar & enable auto hidetaskbar
then taskkill explorer.exe: windowskey + R & run this command:
cmd /c taskkill /f /im explorer.exe
you can resize your explorer.bat window with windowskey + left or up
(PM me if you find any buggs)

copy paste everything below this line & save it as explorer.bat


::----start of explorer.bat----
@echo off&setlocal enabledelayedexpansion
::version 24-jan-2018
::updates will be posted to https://pastebin.com/yWuMdiep
:opendir
set maxdisplayeditems=74
set firstnumber=1
set cnt=0
set cnt1=0
for /f "tokens=*" %%a in ('dir/B/OGN') do set/a cnt+=1
for /f "tokens=*" %%a in ('dir/B/OGN') do (
    set/a cnt1+=1
    set "str!cnt1!=%%a"
    if '!cnt!'=='!cnt1!' goto fill
)
:fill
set cnt2=1
for /l %%a in (1,1,!cnt!) do (
    set/a cnt2+=1
    set arr%%a=ÿ
)
set cnt3=1
set "arr!cnt3!=þ"
:screen
cls
echo Use w(up), s(down) to move the arrow
echo Use e to open file with a specific program
echo Use r to rename a file/directory
echo Use p to run a command
echo Use o to open the selected directory
echo Use b to go back a directory
echo Use c to copy a file/directory
echo Use v to paste a file/directory
echo.
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 74 (set pagelenght=!maxdisplayeditems!) else set pagelenght=!cnt!
for /l %%a in (!firstnumber!,1,!pagelenght!) do (
    echo !arr%%a! !str%%a!
)
choice /c wserpobcv /n>nul
if !errorlevel! EQU 1 (
    set "arr!cnt3!=ÿ"
    set/a cnt3-=1
    set "arr!cnt3!=þ"
    goto screen
)
if !errorlevel! EQU 2 (
    set "arr!cnt3!=ÿ"
    set/a cnt3+=1
    set "arr!cnt3!=þ"
    goto screen
)
if !errorlevel! EQU 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!" (
        start %program% "!check!"
    ) else (
        echo ERROR: File not found&pause>nul
    )
    goto screen
)
if !errorlevel! EQU 4 (
    echo.
    echo rename !str%cnt3%! to what?
    set/p newname=
    ren "!str%cnt3%!" "!newname!"
)
if !errorlevel! EQU 5 (
    echo.
    set/p command=type your command:
    !command!
)
if !errorlevel! EQU 6 (
    pushd "!str%cnt3%!"
    for /l %%a in (%cnt%,-1,1) do (   
        set "str%%a="
    )
)
if !errorlevel! EQU 7 (
    pushd ..
    for /l %%a in (%cnt%,-1,1) do (
        set "str%%a="
    )
)
if !errorlevel! EQU 8 (
    set "filetocopy=%CD%\!str%cnt3%!"
    set "filename=!str%cnt3%!"
    goto screen
)
if !errorlevel! EQU 9 (
    if not exist "%CD%\%filename%" (
        copy "%filetocopy%" "%CD%"
    ) else (
            if not exist "%CD%\%filename% - Copy" (
            set "olddir=%CD%"
            copy "%filetocopy%" "%temp%"
            pushd "%temp%"
            for /f "tokens=1,2 delims=." %%a in ('dir/b ^| findstr "%filename%"') do (
                ren "%filename%" "%%a - Copy.%%b"
                move "%%a - Copy.%%b" "!olddir!"
                popd
                goto opendir
            )
        )
    )
)
goto opendir
::----end of explorer.bat----


Need more help?
Describe your Problem
Example: Hard Drive Not Detected on My PC

Ask Question