Open PowerShell Here

Directory Opus 12.3 and above:

A built-in command exists to open a PowerShell prompt in the current folder, optionally with elevation. Using this is much easier than the older steps below.

You can find options to open PowerShell for the current folder, as admin or as a normal user, in the defualt Tools menu. If that is all you want, you don't need to set anything up; it is already there.

If you want to make your own buttons or hotkeys, the same CLI DOSPROMPT... command used to open a normal command prompt can now be used for PowerShell.

For example, CLI DOSPROMPT=powershell or CLI DOSPROMPT=powershell,admin

The PowerShell ISE can also be launched instead of the basic PowerShell:

For example, CLI DOSPROMPT=powershellise

Older versions of Opus:

Follow the steps below to make a button which opens a Windows PowerShell in the current directory.

The button will act like the Command Prompt Here shell extension, or CLI DOSPROMPT Opus command, except that it will open a PowerShell instead of a DOS Prompt.

On older versions of Windows, you have to download and install Windows PowerShell first, of course. You can download it from Microsoft, but they keep breaking old URLs so you'll need to find the appropriate version for your version of Windows.

There are a few different ways to open a PowerShell prompt in a particular directory. The easiest way is to create a button which simply runs PowerShell.exe, but this will open a window with the boring old MS-DOS icon. If you follow the steps below you can make an Opus button which opens PowerShell in the current directory and with the PowerShell icon in its window. (This isn't just something pretty to look at, it makes it easier to find your PowerShells on the taskbar.)

  • Right-click the Windows PowerShell shortcut in your Start Menu, select Copy and then Paste it somewhere else.
  • Edit the new shortcut's Properties, go to the Shortcut tab, and erase the Start In parameter.
    • By default the parameter is %HOMEDRIVE%%HOMEPATH% but if you remove it then the shell will open in whatever the current directory is.
  • Create a new, blank Opus button.
    • Note that if you drag the shortcut to an Opus toolbar while in customize mode then Opus will create a button which runs PowerShell.exe directly, so don't do that.
    • We will be making a button that runs the shortcut (.lnk file) itself, not PowerShell.exe, in order to get the desired icon and window size/colour settings which are stored in the shortcut.
  • Set the button's Start In parameter to {sourcepath}
  • Set the button's Function parameter to the shortcut (.lnk) file's path.
    • You can get the path by selecting the shortcut and then using Edit > Copy Full Pathnames from the default Opus menus.
    • Remember to add quotes around the filepath if it has any spaces.

If you want the option of opening PowerShell for the selected folder instead of the current folder (particularly useful if you want to put it on the context menu for folders), use this as the command instead (click Advanced in the button editor to make it go multi-line):

cd {sourcepath}{file}
"C:\Users\Tester\Windows PowerShell.lnk"

That will open PowerShell for the current folder if nothing is selected, and open it for the selected folder if one is selected.

Remember, if you are using newer versions of Opus then there is a simple, built-in command to do all of this, so you should only have followed these complex steps if you need them for an old version.

Root post updated for Opus 12.3. There is now a simple one-line command to open PowerShell or the PowerShell ISE, and it is now in the default menus.

Also pruned old conversations from the thread, as they should all be consolidated into the first post now, to keep things easy to read.

Is there a way to create a "Open Terminal here" and "Open Terminal Here (as Admin) for the new w11 Terminal ?

Also for the PowerShell Admin, is there anyway to have it NOT default to that retina burning Red background ?

Based on this thread it may already be in the folder background right-click menu.

If it's not there, or you want to add it somewhere else, Alex's later post found this command worked to open Terminal in the current directory. Reproduced for easier reading:

wt.exe -d {sourcepath$}


There's also Terminal command line arguments if you need to do something extra.

1 Like