r/PowerShell • • Aug 08 '18

TIL you can launch powershell from explorer

Today I learnt if you typed powershell in the explorer it will open up in the current directory of the explorer.

132 Upvotes

53 comments sorted by

4

u/Eijiken Aug 08 '18

and if you want to open up ISE you type powershell_ise

2

u/detenshi12 Aug 08 '18

that is awesome =D

2

u/ka-splam Aug 08 '18

or, in Powershell 5.1 with default aliases, just ise

35

u/Swarfega Aug 08 '18

You can also do the reverse of this in PowerShell with

ii .

Which is the short version of...

Invoke-Item -Path .

7

u/Epithanatios Aug 08 '18

Or start .

3

u/ka-splam Aug 08 '18

start has the advantage of working the same way in cmd.exe

1

u/Swarfega Aug 08 '18

Or

saps .

But I prefer ii as it's two chracters less ;)

1

u/Epithanatios Aug 08 '18
> Function Oh-Snap {
  ii .
}

> Oh-Snap

(I also like the shorter characters. I didn't know about ii .)

2

u/Swarfega Aug 08 '18

Get-Alias to list them all :)

4

u/admiralspark Aug 08 '18

Or

Explorer .

0

u/[deleted] Aug 08 '18

[deleted]

1

u/arpan3t Aug 08 '18

Just tried it and:

server execution failed

1

u/get-postanote Aug 08 '18

If you mean the GUI as like on your host, then no.

Explorer runs in your context not the remote user context. As a matter of point you cannot run PS in a remote user context natively. It's a Windwos security boundary and by design.

PSSession is not a GUI replacement for RDP. 8^}

Yet, you can use it instead of RDP of course (which is one of the PS Remoting main points) for almost whatever you'd like to do on that remote host. Well, as long as you have permissions.

22

u/Ta11ow Aug 08 '18

Same thing with any application that is in an $env:Path location :)

Very handy. On windows 10, you can also shift-right-click in any explorer window to show the 'open PowerShell window here' option

3

u/Haribo112 Aug 08 '18

For me, that gives 'open command window here'

4

u/Ta11ow Aug 08 '18

It does depend on the exact version and settings. You can change it in the Settings app somewhere, I forget exactly, but it goes hand in hand with the settings for whether or not PS or cmd show up in the right-click menu from the start button.

The default was changed to PS a handful of months ago, but I don't think it overrode existing settings (so lots of people still have it set to cmd)

3

u/R-EDDIT Aug 09 '18

Just gave me an idea... I'll leave this here (one liner to find left directories in the path.

PS C:\> $env:path -split ";" | %{ if (-not (test-path $_)) {write-host "Orphaned $_"}}
Orphaned C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static

8

u/TheMagicTorch Aug 08 '18

You can also Shift+Right-click in the file list in Windows 10 and choose the Open Powershell option.

You may need to enable the setting to open Powershell instead of Command Prompt, although I think it's default on version 1609 onwards.

8

u/[deleted] Aug 08 '18

Alt, F, S, A - wait a sec, Alt-Y.

A little wonky at first but eventually it's a quick way to achieve the same thing.

Alt, F, S, R - for non-admin

4

u/ihaxr Aug 08 '18

You can just do ALT + F, R for non-admin... no need to manually navigate the submenu since the shortcut for "Open Windows PowerShell" is in both places--the main menu under Open New Window and the "S" submenu.

1

u/[deleted] Aug 08 '18

Oh - nice I clearly missed that. Thanks for the extra info!

4

u/robisodd Aug 08 '18

Also, if you don't have an Explorer window open you can press Window+x then i, or for admin powershell press Window+x then a

2

u/[deleted] Aug 08 '18

Nice - that is very helpful!

1

u/nvpqoieuwr Aug 08 '18

This opens git bash for me. mingw64. Now how to change it back...

1

u/[deleted] Aug 08 '18

Ooh, nice! Just Alt-FSA did it for me... what does the Alt-Y do?

1

u/Thomhandiir Aug 08 '18

It will press yes on the UAC prompt if there is one, at least I assume so, based on my test. :P

2

u/[deleted] Aug 08 '18

Ah, I see. We're using standard accounts here so I had to enter admin credentials.

1

u/[deleted] Aug 08 '18

Yep that's it!

0

u/[deleted] Aug 08 '18

[deleted]

1

u/[deleted] Aug 08 '18

I have powershell replacing the command prompt, maybe that has something to do with it. Also maybe try without having any files selected?

1

u/sevenillusions Aug 08 '18

how exactly did you do that? sounds neat af

2

u/[deleted] Aug 08 '18

There's an option in the Windows settings to allow that - I'm at work or I'd dig for it. I can let you know tonight after I get home, sorry!

5

u/[deleted] Aug 08 '18

Not all heroes wear CAPS.

3

u/chopstyks Aug 08 '18

Thank you for this. You're doing God's work.

2

u/kelevra206 Aug 08 '18

that is actually really cool! thanks for the protip.

2

u/sevenillusions Aug 08 '18

awesome,thx kind stranger

2

u/robisodd Aug 08 '18

This is a holdover from being able to do this with the Command Prompt by typing cmd into the folder path area.

2

u/ppumkin Aug 08 '18

Wow. I learnt two thing today. These are so useful I always cut and past the path across. Dumb ass I r.

2

u/cosine83 Aug 08 '18

Other handy ways to open PowerShell:

  • Shift+Right-click the directory you're browsing in explorer

  • Win+X > a

Depending on your Taskbar Settings will determine if the above will be a command prompt or a powershell console.

2

u/mickjf Aug 09 '18

I wonder if it works for a command prompt as well (I know, wrong sub). Hey Presto!! Type CMD into the explorer bar - it works as well. TIL2.

2

u/get-postanote Aug 09 '18

You can simply add a shortcut configured however you choose and add that to the SendTo folder, then in Explorer, right-click slect 'SendTo' and choose your configured shortcut.

I too, always run as a regular user/locked down, with machine PS set to restricted (I know, I know, most use remote signed) but my session run at my required executiopolicy,

I have two sets of PS shortcuts (console/ISE/VSCode) , normal and admin. Pinned to my taskbar. I have those same shortcuts in my SendTo folder for any right click effort.

I always start my PS / VSCode / PSS sessions as admin, because if I am in these tools I am doing admin level stuff.

I test stuff only using regular user shortcuts.

3

u/trcx Aug 08 '18

Shift + Right Click in Explorer > Open PowerShell Window Here

1

u/crypticedge Aug 08 '18

Yep, you can also pass scripts and commands through that as part of a single line.

I have some scripts that use both as needed, and call posh in bypass to run functions that need that extra power

1

u/[deleted] Aug 08 '18

Can you open it as admin, though? We use standard accounts here and elevate to admin.

Edit: here's now

1

u/TheRealMisterd Aug 08 '18

Now, if it could only handle $Variables like it does %Variables%

1

u/brassbound Aug 08 '18

Well, that's unexpected. Thanks!

1

u/AutoModerator Aug 08 '18

Sorry, your submission has been automatically removed.

Accounts must be at least 1 day old, which prevents the sub from filling up with bot spam.

Try posting again tomorrow or message the mods to approve your post.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/state_of_alaska Aug 08 '18

And if you type

code

into powershell, if installed Visual Studio code will start

1

u/FstLaneUkraine Aug 08 '18

Oh, this is nifty. I knew you could hold shift while right clicking and it'd allow you to 'open powershell window here' but this is just as nifty. Thanks.

EDIT: Didn't read all the comments. That's already been mentioned lol.

1

u/jantari Aug 09 '18

I prefer to shift-rightclick, typing out "powershell" is a little long in the tooth

1

u/Tibey Aug 08 '18

But Shift + Right-click + "Open Powershell Window here" is still faster :) (though only recent Windows version propose Powershell instead of cmd)