Giter VIP home page Giter VIP logo

powershell-open-here-module's Introduction

PowerShell "Open Here" Module

PowerShell module that enables "Open here" shortcuts functionality for Windows PowerShell, PowerShell Core, Windows Terminal, Bash 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, PowerShell Core, Bash
  • Open here with non-elevated privileges shortcut.
  • Open here with elevated privileges shortcut.
  • Shortcut availability on directory, drive, directory background, user's desktop.
  • Default setting for easy-to-use.
  • Fully customizable shortcut names.
  • Fully customizable shortcut icon.
  • Capability of showing the shortcut only if the SHIFT key is pressed.
  • 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
Import-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
Set-OpenHereShortcut -ShortcutType:PowerShellCore

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 the default EXE icons as the shortcut icons, use -UseExeIcon:

Set-OpenHereShortcut -ShortcutType:WindowsTerminal -UseExeIcon

To show the Open Here shortcut only if the SHIFT key is pressed and the right mouse button is clicked, use -UseShift:

Set-OpenHereShortcut -ShortcutType:WindowsTerminal -UseShift

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?

I consider this module feature complete. If you have some idea or suggestion, please open an issue. I definitely have a look on your suggestion.

Can I customize the shortcut icon?

By default, OpenHere module uses its own icons in shell context menus. If the -UseExeIcon switch is used when shortcut is created, the default icons are not generated. These default icons are written in %LOCALAPPDATA%\OpenHere\[ShellType]. Every shell has its own Icon.ico file in the corresponding subfolder. You can customize icons by overriding these Icon.ico files.

Can I override the names and setup?

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.

Windows Command Prompt icon looks weird when Windows Black theme is turn on. What should I do?

You could either run Set-OpenHereShortcut again with -UseExeIcon or override the icon by some other ico file. Have a look at the previous FAQ about the shortcut icon customization for details.

Links

OpenHere module at PowerShell Gallery

Attributions

Get-Icon
CMD icon
PowerShell icon
PowerShell Core icon
WSLBash icon
PNG to icon online converter
PNG to base64 online converter

powershell-open-here-module's People

Contributors

kutlime avatar mbartelsm avatar solvingj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

powershell-open-here-module's Issues

Support for PowerShell Core 6

The goal of this enhancement is:

  1. Provide PowerShell Core custom shortcut experience.
  2. Provide a possibility to create the PowerShell Core shortcut after PowerShell Core installation without a need to reinstall it.

open all in a single window

image
when i click "Open here" and I had a window open earlier, i hope they all open in a window.
in other words, when i click "Open here" twice, they are both in a window


image
โ†‘ this is NOT what i want


image
โ†‘ this is what i want

Create an Admin menu item at the top level

The extra click to expand the menu to get to an admin-level context menu item seems to be unavoidable with the current options.

It seems that flexibility would be greatly enhanced by generalizing this solution to be able to specify that you are trying to create a top-level item rather than something in a expanding menu.

Runas is fake and not working with WT

image
This command is same for both
\HKEY_CLASSES_ROOT\Directory\ContextMenus\Terminal\shell\runas\command
and
\HKEY_CLASSES_ROOT\Directory\ContextMenus\Terminal\shell\openterminal\command

And runas command also doesn't work at all

Support for PowerShell Core 7

The goal of this enhancement is:

  1. Provide PowerShell Core custom shortcut
  2. Provide a possibility to create the PowerShell Core shortcut after PowerShell Core installation without a need to reinstall it.

Related issue: #11

All menu's under a single root

I tried this expecting them to all show up under a single root. Instead, they all created their own duplicate root item called "Prompts". Can the desired behavior be supported?

Set-OpenHereShortcut -ShortcutType:Windowsterminal -RootName 'Prompts' -OpenHere 'Terminal' -OpenHereAsAdmin 'Terminal as Admin'
Set-OpenHereShortcut -ShortcutType:WindowsPowerShell -RootName 'Prompts' -OpenHere 'Powershell' -OpenHereAsAdmin 'Powershell as Admin'
Set-OpenHereShortcut -ShortcutType:CMD -RootName 'Prompts' -OpenHere 'CMD' -OpenHereAsAdmin 'CMD as Admin'

Opening specific profile in Windows Terminal

Hi,
is it possible to use this to open a specific profile (i.e. not the default profile) in Windows Terminal?
For example, my default profile is the WSL Bash, but I would like to open a powershell tab in Windows Terminal.
Thanks

Launching powershell window at first.

I noticed after add open here in Windows terminal, one powershell window will prompt first. It would be better if windows terminal can be launched directly.

Refactoring of icon handling

The current approach of icon handling is to create a folder in LOCALDATA, download the shell's icon from the GitHub repository or create the icon when download fails from a base64 string.

The new approach will use EXE icon by default, brings a new switch -UseCustomIcon to the Set-OpenHereShortcut. The current approach will be used when -UseCustomIcon will be present in a SetOpenHereShortcut call.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.