How to fast browse folders on PowerShell/Prompt


RiseFall

Active member
Local time
2:30 PM
Posts
6
Visit site
OS
Windows 7, Windows 8.1, Windows 10
I'm looking for a software, inside PowerShell or Prompt, which allows to browse folders rapidly, using arrow keys.

In Linux I use "Midnight Commander" with a trick, and I can easily navigate and quit the program on the current folder.

I'm looking something like that without leaving the PowerShell or Prompt window.
 

My Computer

System One

  • OS
    Windows 7, Windows 8.1, Windows 10
Far Manager ?

{
"commandline": "\"%ProgramFiles%\\Portable\\far\\far.exe\"",
"guid": "{1d11ffe9-ea19-53fd-a481-6e1a8e6c9911}",
"historySize": 1001,
"name": "Far Manager",
"startingDirectory": "%TEMP%",
"useAcrylic": false
},
 
Last edited:

My Computer

System One

  • OS
    Microsoft Windows 11 Home
    Computer type
    PC/Desktop
    Manufacturer/Model
    MSI MS-7D98
    CPU
    Intel Core i5-13490F
    Motherboard
    MSI B760 GAMING PLUS WIFI
    Memory
    2 x 16 Patriot Memory (PDP Systems) PSD516G560081
    Graphics Card(s)
    GIGABYTE GeForce RTX 4070 WINDFORCE OC 12G (GV-N4070WF3OC-12GD)
    Sound Card
    Bluetooth Аудио
    Monitor(s) Displays
    INNOCN 15K1F
    Screen Resolution
    1920 x 1080
    Hard Drives
    WD_BLACK SN770 250GB
    KINGSTON SNV2S1000G (ELFK0S.6)
    PSU
    Thermaltake Toughpower GF3 1000W
    Case
    CG560 - DeepCool
    Cooling
    ID-COOLING SE-224-XTS / 2 x 140Mm Fan - rear and top; 3 x 120Mm - front
    Keyboard
    Corsair K70 RGB TKL
    Mouse
    Corsair KATAR PRO XT
    Internet Speed
    100 Mbps
    Browser
    Firefox
    Antivirus
    Microsoft Defender Antivirus
    Other Info
    https://www.userbenchmark.com/UserRun/66553205
Tell me if I'm wrong, but in the way you describe I'll create a profile for the Terminal, which will open immediately Far Manager and when I close it, the window itself will be closed.
 

My Computer

System One

  • OS
    Windows 7, Windows 8.1, Windows 10
Windows build of Midnight Commander:

Some other text based file managers:
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
If GUI file managers are something you'd consider, I recommend the 7-Zip file manager (7zFM.exe). It's tiny, fast, and has a clean no-nonsense interface with keyboard shortcuts for everything.
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
Windows build of Midnight Commander
It's the first I tried because I use it on Linux.
It seem that it cannot quit on current folder as it does on Linux.

Far Manager is the second I tried, seem it cannot quit on current folder too. I can copy current path on clipboard as workaround but it doesn't use quotes on paths. So, it's even not a real workaround.

Basically the two above seem exactly what I need, they start on Powershell window without opening a separate window and their interface is perfect for my needs. Unluckily they both seem to miss the opportunity to quit in current folder when closed.

Dos Navigator, seem it cannot start from the opened window of PowerShell and then close and back to it.

Ranger, maybe is only for Linux?

Vifm, seem that cannot start from opened window of PowerShell too.

If GUI file managers are something you'd consider

No, I'm looking something like Midnight Commander or Far Manager, which starts inside the PowerShell/CMD window where I'm actually work, let me browse to the folder I need, and then leave me in the current folder.

Maybe I have to use the Far Manager with SHIFT+ALT+INS hotkey to copy the current path, quit, write CD and then add quotes to the copied path or maybe Midnight Commander with some other even trickier hotkey.

Thank you all for your efforts.
 

My Computer

System One

  • OS
    Windows 7, Windows 8.1, Windows 10

My Computer

System One

  • OS
    Windows 11 23H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    custom
    CPU
    intel i7-8700 (non-K)
    Motherboard
    Asus Z370 TUF Gaming
    Memory
    32Gb
    Graphics Card(s)
    On-board Intel iGPU
    Sound Card
    On-board Realtek
    Hard Drives
    Samsung_SSD_850_EVO
    PSU
    Corsair Rm850X
    Cooling
    All air
Have you tried something like a "powershell equivalent of the mc_wrapper.sh script" shown here?


This suggestion looks cleaner:
 

My Computer

System One

  • OS
    Windows 7
This suggestion looks cleaner
Looking for your second link,

I made a file called "mc-wrapper.ps1" and pulled on "C:\Program Files (x86)\Midnight Commander".

Then I pasted on it:

$mc_tmp_file = [System.IO.Path]::GetTempFileName()
& "${PSScriptRoot}/mc.exe" "--printwd=${mc_tmp_file}" "${args}"
$mc_path = get-content -Path "${mc_tmp_file}"
cd "${mc_path}"
remove-item -Force -Path "${mc_tmp_file}"

Then on Powershell as admin:

Set-Alias -Name mc -Value "C:\Program Files (x86)\Midnight Commander\mc-wrapper.ps1";

Unluckily after closing Midnight Commander the path is not the current but the same when I launched MC.

Maybe I wrong something (or miss something) on what I did above?
 

My Computer

System One

  • OS
    Windows 7, Windows 8.1, Windows 10
I just realized the Windows version of mc.exe doesn't appear to save anything to file using --printwd or -P.

If you look up the primary MC project page, it says they're not responsible for the Windows port. So you'd have to ping the GitHub dev.
 

My Computer

System One

  • OS
    Windows 7
@RiseFall
Try this.
Important: First set the alias for mc in your User Profile, so the alias is available whenever you launch Powershell.
Then place the following mc-wrapper.ps1 inside the mc program folder. It is the same one that I linked to earlier (just cleaned it up a little).
When you run mc in ps, then on exiting mc, when you are back at the powershell prompt, the directory should be set to the last active directory that you were browsing in mc (which I think is what you want). It appears to be working at my end.

mc-wrapper.ps1
Code:
$ErrorActionPreference = 'Stop'
$mc_exe_dir =  "${PSScriptRoot}"
$mc_exe_path = "${mc_exe_dir}/mc.exe"

$mc_printwd_path = [System.IO.Path]::GetTempFileName()
Remove-Item "${mc_printwd_path}"

& "${mc_exe_path}" "--printwd=${mc_printwd_path}" "${args}"

try {
  $mc_exitpath = get-content -Path "${mc_printwd_path}"
  cd "${mc_exitpath}"
  remove-item -Force -Path "${mc_printwd_path}"
} catch {
  #
}
Tested with mcwin32-build230-x64.
Good luck.
 

My Computer

System One

  • OS
    Windows 11 23H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    custom
    CPU
    intel i7-8700 (non-K)
    Motherboard
    Asus Z370 TUF Gaming
    Memory
    32Gb
    Graphics Card(s)
    On-board Intel iGPU
    Sound Card
    On-board Realtek
    Hard Drives
    Samsung_SSD_850_EVO
    PSU
    Corsair Rm850X
    Cooling
    All air
Thank you VERY much!

profile.ps1 on "C:\Users\<USER>\Documents\PowerShell" with the alias

and

mc-wrapper.ps1 on "C:\Program Files (x86)\Midnight Commander" with the script from your last post

Did the trick!
 

My Computer

System One

  • OS
    Windows 7, Windows 8.1, Windows 10
Back
Top Bottom