r/PowerShell • • Jan 28 '25

PS-based alternative to File Explorer?

In a nutshell, my work computer is massively locked down - except, strangely, for scripting.

I wasn't clear with my intiial post. I cannot install an EXE on my computer. That is why I am looking for a script-based solution.

I need the intervention of a team of IT, plus the sacrifice of a live Mountain Dew, to compile code from my company-installed Visual Studio, but I can grant myself permission to run PS scripts without any safety brakes (and Batch and VBS, for that matter).

Franky, I'm dying for a dual-window file explorer. That would be a serious upgrade to my life. Does such a thing exist?

A file-search functionality that doesn't suck as much as File Explorer's version would be nice, too. If I search for "May" in my Documents folder, I probably do not want every single file containing the verb "may" in it - but FE will return just that.

Does such a thing exist?

1 Upvotes

30 comments sorted by

9

u/chadbaldwin Jan 28 '25

Not sure exactly what you're looking for...but here's some tools I use:

  • VoidTools Everything - file indexer and search tool. Indexes every file on the computer in near realtime. Has excellent search features, including a CLI interface (installed separately). However it only searches paths and some metadata, not content.

  • Ripgrep (rg) - a rust based supercharged CLI grep/search tool. Let's you search the contents of files using regex incredibly fast

  • fd - another rust based CLI tool, great way to list and search filenames, doesn't require an indexer, but also means it wouldn't be as capable searching system wide. It's better for searching specific directories

  • fzf - similar to fd, but interactive in the CLI. It does fuzzy search matching to all files recursively, and has support for things like multi select. It then can output the results to other commands

  • PowerShell module - ZLocation - a better cd, it keeps track of all the directories you visit, applies weights to them and allows you to quickly and easily jump around in PowerShell like z desk would jump to your desktop (once it learns it)

I use all of these every day and at this point I rarely even use explorer anymore. Or if I do, I'm often opening it from PowerShell after using one or more of those tools.

2

u/BroomIsWorking Jan 28 '25
  • PowerShell module - ZLocation - a better cd, it keeps track of all the directories you visit, applies weights to them and allows you to quickly and easily jump around in PowerShell like z desk would jump to your desktop (once it learns it)

OK, THAT looks like it might be useful to me for searching for files.

Thanks!

5

u/prog-no-sys Jan 28 '25

look into zoxide. More modern, cross-platform, built in rust 🤓, can even import your zlocation data into it

all the things lol

2

u/IAmBroom Jan 29 '25

And rust, AFAICT, needs to be compiled, so it's a non-starter.

1

u/chadbaldwin Jan 29 '25

Can you elaborate on this? I'm not sure what you're implying.

In my comment, 3 of the tools I listed are written in rust, all of which have windows versions provided as part of their standard releases. Same goes for this zoxide tool.

Most of them you can install just by using winget.

1

u/IAmBroom Feb 01 '25

Sure. My original post omitted one important detail: I cannot keep any *.exe file on my computer, outside of C:\Program Files and C:\Program Files x86.

I can use scripts (*.bat, *.ps1, *.vbs, etc.). So the solution can't be something I have to compile.

2

u/chadbaldwin Jan 28 '25

Yup it's great. Just keep in mind it's only going to keep track of directories you visit in PowerShell, not in Explorer, though that would be cool if it did.

I forget how it works but it somehow has a hook in PowerShell and each time you visit a directory using either cd or z it adds to its database and updates the weight.

This way if you have multiple directories with similar prefixes and you just do z foo it will pick the one with the highest weight.

1

u/chadbaldwin Jan 28 '25

Also, if your main goal is to find better ways to search for files...I HIGHLY recommend trying out VoidTools Everything. I'm not kidding when I say this...I probably use it 50+ times a day. I prefer to use the GUI, but I do use the CLI every once in a while.

Though usually if I'm in the CLI, I prefer to use fd or fzf as those are much more intuitive to use in the CLI vs trying to remember all the switches and query language for Everything.

ZLocation is great, but mostly just for jumping around where you need to go. For a while, I had a shortcut connected to an extra mouse button that would open powershell, I wrote a PowerShell function called "zz" and all it would do is jump to the location, open explorer and close powershell.

So instead of navigating with Explorer, I'd just type "zz foobar" and it'd open the directory in file explorer.

And Ripgrep is usually for things like searching code for certain references...I still use it quite a bit, but Azure code search and VS Code multi-file search sometimes takes its place.

5

u/ImperialKilo Jan 28 '25

I mean, if you're very industrious you can duplicate File Explorer entirely using WPF, XAML and powershell. I've done something similar so end users can manage permissions groups with a GUI instead of using ADU&C.

From a conceptual level, this should be super easy. (Learning the tools would be most of the effort)

Use Get-ChildItem to list a folder's contents, then use a foreach block with Get-Item to grab specifc item properties (if needed) and display them in an -OutGridView or a custom WPF ListBox (then program functionality for clicking and selection).

Runspaces would allow a silky-smooth UI with multithreading and a custom WPF form could easily do dual-pane stuff, or even a view like Linux's Ranger (my beloved).

Try it out if you have time. You'll learn a lot, I'm sure.

2

u/BroomIsWorking Jan 28 '25

Yes, I could probably do so, but if I can find a script already written that allows dual-pane navigation of folders, I'd be saving myself loads of hours of work.

2

u/prog-no-sys Jan 28 '25

You could look into terminal based file managers like Yazi or Ranger

If you can't download or install an exe, you can build these from source easily more than likely.

Best of luck op :)

1

u/BroomIsWorking Jan 29 '25

Interesting... They seem to have blocked commands like Install-PSResource:

Install-PSResource : The term 'Install-PSResource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

and the same happens for similar commands.

2

u/ImperialKilo Jan 29 '25 edited Jan 29 '25

Are you using Windows Powershell? The module isn't installed by default. Run this:

Install-Module Microsoft.Powershell.PsResourceGet

Or use Powershell 7. It's installed by default.

Edit: if there's a cmdlet that someone references but your session doesn't recognize, look up the Microsoft doc for it and install the module it's from.

1

u/_Buldozzer Jan 28 '25

Have you ever tried to run Totalcomander?

1

u/BroomIsWorking Jan 28 '25

Sorry, I wasn't clear enough. EXEs are forbidden.

1

u/_Buldozzer Jan 28 '25

Try renaming Totalcomander to sc.exe, cmd.exe or powershell.exe. That could work, since you are able to run scripts. Those executables need to be excluded, otherwise you can't run scrips.

1

u/Djust270 Jan 29 '25

Any good security software should be looking at the file hash and not just the file name, but its worth a try.

1

u/_Buldozzer Jan 29 '25

More often than not it's just the old GPO "Don't run specified programs" this one can easily be fooled by renaming the exe.

2

u/BroomIsWorking Jan 29 '25

No, it's "Don't allow any *.exe files." But it's worth a try.

1

u/Owlstorm Jan 28 '25

It sounds like you want GUI tools rather than CLI - Everything/TotalCommander/WinSCP etc.

That said, I think File Explorer is good enough to tolerate given the locked down work environment.

-7

u/BroomIsWorking Jan 28 '25

I obviously don't share your opinion, so I'm not sure what that serves.

1

u/IAmBroom Jan 29 '25

Typical. His post was "I don't believe your opinion is valid", and that's somehow worth upvoting.

2

u/mdgrs-mei Jan 29 '25

PowerShellRun is a terminal based launcher and has File Manager utility. It navigates the folder hierarchy with fuzzy search. It doesn't have a file content search feature though.

3

u/[deleted] Jan 28 '25
  • get-item .

  • get-childItem

  • dir

/s

1

u/purplemonkeymad Jan 29 '25

I need the intervention of a team of IT, plus the sacrifice of a live Mountain Dew, to compile code from my company-installed Visual Studio

You know you can compile code right in powershell. As long as your target is a library, and i don't think you can add resources but:

$files = Get-childitem *.cs
Add-type -LiteralPath $files.fullname -OutputAssembly .\mylibrary.dll

You can add the library later in a new session by just giving add-type the path to the library:

Add-Type -path .\mylibrary.dll

I would still stick to msbuild if you can though.

1

u/IAmBroom Feb 01 '25

OK, so far it looks like *.dll files aren't forbidden, just *.exe. This might be useful.

1

u/Djust270 Jan 29 '25

This may suite your needs https://github.com/djust270/Misc.-Tools/blob/main/Dual%20Window%20File%20Explorer.ps1 I made this with the help of Claude. For searching Im using the Everything PS module so you would need that as well but feel free to do with it as you please.

-4

u/Jainith Jan 28 '25

Sounds like a case for Windows Terminal?
https://learn.microsoft.com/en-us/windows/terminal/panes
There's a bunch of ways of installing it, maybe one of them isn't blocked in your environment.
https://github.com/microsoft/terminal

2

u/IAmBroom Feb 01 '25

WOW! Why are users in this forum so toxic? All you did was offer a suggestion, and you've been downvoted as much as I have for the sin of having an opinion.