Question

I frequently use

ii .

in PowerShell to open the current directory in Windows Explorer. This used to work all the time, but now nothing happens.

The Invoke-Item cmdlet still works. Doing ii somefile.txt opens that file in a text editor. But directories don't work anymore.

In addition start . doesn't work. Using explorer . does work.

Running

Trace-Command -Name ParameterBinding {ii .} -PSHost

returns

DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [Invoke-Item]
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Invoke-Item]
DEBUG: ParameterBinding Information: 0 :     BIND arg [.] to parameter [Path]
DEBUG: ParameterBinding Information: 0 :         Binding collection parameter Path: argument type [String], parameter type [System.String[]],
collection type Array, element type [System.String], no coerceElementType
DEBUG: ParameterBinding Information: 0 :         Creating array with element type [System.String] and 1 elements
DEBUG: ParameterBinding Information: 0 :         Argument type String is not IList, treating this as scalar
DEBUG: ParameterBinding Information: 0 :         Adding scalar element of type String to array position 0
DEBUG: ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Path] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Invoke-Item]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : CALLING EndProcessing

Running

Trace-Command -Name CommandDiscovery {ii .} -PSHost

returns

DEBUG: CommandDiscovery Information: 0 : Looking up command: ii
DEBUG: CommandDiscovery Information: 0 : Alias found: ii  Invoke-Item
DEBUG: CommandDiscovery Information: 0 : Cmdlet found: Invoke-Item  Microsoft.PowerShell.Commands.InvokeItemCommand,
Microsoft.PowerShell.Commands.Management, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

I guess maybe there's a file association problem or something. But I can't figure out what Invoke-Item is actually calling or how to change it.

How can I get this working again?

Was it helpful?

Solution

It is very tough to figure out exactly why it might not work for you anymore, but why not use the alternative which is the same in powershell and cmd:

start .

( explorer . works too)

If ii . is important, then try restarting Powershell console and / or the computer. Also try doing ii . -whatif to see if you get any clue on why it doesn't work anymore.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top