/PowerShell-Open-Here-Module

PowerShell module that enables "Open here" functionality for PowerShell.

Primary LanguagePowerShellGNU General Public License v2.0GPL-2.0

PowerShell "Open Here" Module

PowerShell module that enables "Open here" shortcuts functionality for Windows PowerShell, Windows Terminal and CMD.

Introduction

OpenHere is a PowerShell module for installation of shell shortcuts into the context menu (the right mouse button click or the menu key) for Microsoft Windows.

The shortcuts will open desired shell in the current location, e.g. for Windows PowerShell $PWD will be set to the location from which the shortcut was invoked.

Preview

Main features

  • Shortcut installation/removal for Windows PowerShell, Windows Terminal, CMD
  • Open here with non-elevated privileges shortcut.
  • Open here with elevated privileges shortcut.
  • Default setting for easy-to-use.
  • Fully customizable shortcut names.
  • Shortcut availability on directory, drive, directory background, user's desktop.
  • Rollback of all shell modifications.
  • Works offline.
  • Well documented

Basic use

To install the OpenHere module, just type following command into your PowerShell session with elevated privileges.

Install-Module -Name OpenHere

Now, you can use the module as you wish. For shortcut installation:

Set-OpenHereShortcut -ShortcutType:WindowsPowerShell

Preview

For other shortcuts just type:

Set-OpenHereShortcut -ShortcutType:WindowsTerminal
Set-OpenHereShortcut -ShortcutType:CMD

For a custom shortcut & command names, fill parameters accordingly:

Set-OpenHereShortcut -ShortcutType:WindowsPowerShell -RootName 'Old PowerShell' -OpenHere 'I''m lazy' -OpenHereAsAdmin 'I''m lazy admin'

or the equivalent with the escape backtick:

Set-OpenHereShortcut -ShortcutType:WindowsPowerShell`
-RootName 'Old PowerShell' `
-OpenHere 'I''m lazy' `
-OpenHereAsAdmin 'I''m lazy admin

Preview

To remove the shortcut with any settings, just call:

Remove-OpenHereShortcut -ShortcutType:WindowsTerminal

For more details about setting/removing process, type:

Set-OpenHereShortcut -ShortcutType:WindowsTerminal -Verbose
Remove-OpenHereShortcut -ShortcutType:WindowsTerminal -Verbose

respectively.

For more examples, type:

Get-Help Set-OpenHereShortcut -Examples

Notes

Windows Terminal doesn't responds to RunAs request from the context menu. This problem is a limitation of the UWP platform. A workaround has been implemented to support Windows Terminal shortcut with elevated privileges. A similar workaround had to be implemented for non-elevated Open here Windows Terminal shortcut to support scenarios when requests are invoked from RMB clicks on a directory or a drive letter.

FAQ

Are there any plans to extend the functionality of this module?

Yes, see the section Planned features.

Can I customize the shortcut icon?

Yes, override the Icon.ico file in %LOCALAPPDATA%\OpenHere\[ShellType] and you are good to go.

Can I override the names?

Yes, just run Set-OpenHereShortcut with a new configuration.

Is the name limited to English?

No, the shortcut names supports Unicode and this is only limitation as I'm aware of.

Planned features

  • PowerShell Core
    • A customizable functionality. The Windows installation of PowerShell Core doesn't support any customization of the shell shortcuts so far.
    • Waiting for PowerShell Core 7.0.0 RTM as primary support target.

Links

OpenHere module at PowerShell Gallery

Attribution

Get-Icon
CMD icon PowerShell icon