Skip to content

Invoke-Item -Path does not work  #4252

Closed

Description

PS C:\PowerShell\6.0.0-beta.4> ii -Path c:
ii : Access is denied
At line:1 char:1

  • ii -Path c:\
  •   + CategoryInfo          : NotSpecified: (:) [Invoke-Item], Win32Exception
      + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.InvokeItemCommand
    
    

PS C:\PowerShell\6.0.0-beta.4> $PSVersionTable

Name Value


PSVersion 6.0.0-beta
PSEdition Core
GitCommitId v6.0.0-beta.4
OS Microsoft Windows 10.0.16226
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Activity

  1. added
    Issue-Bug
    on Jul 14, 2017
  2. added this to the milestone on Jul 14, 2017
  3. mklement0 commented on Jul 14, 2017

    @mklement0
    Contributor

    Just to spell it out: any directory path triggers the bug (as opposed to a file path).

    • On Windows, the terminating error cited above occurs.

    • On Unix (macOS, Linux), the command is a quiet no-op (no action, no output, $? is $True).

  4. MaximoTrinidad commented on Jul 14, 2017

    @MaximoTrinidad

    Hum! I'm not getting the error and I'm on Windows 10 Insider Build 16237. I can use the Tab key and it auto-completes the line. I'm getting valid errors.

    PS C:\Program Files\PowerShell\6.0.0-beta.4> $PSVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      6.0.0-beta
    PSEdition                      Core
    GitCommitId                    v6.0.0-beta.4
    OS                             Microsoft Windows 10.0.16237
    Platform                       Win32NT
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    WSManStackVersion              3.0
    

    Ah! This is if you don't auto-complete what you're typing. Press Enter after typing c: then the error happens. I normally use the tab to auto filled the line.

    Definitely the error is not the correct one!

    ps5ii_2017-07-14_10-04-53

  5. mklement0 commented on Jul 14, 2017

    @mklement0
    Contributor

    Maximo Trinidad (@MaximoTrinidad): The bug is unrelated to tab completion. The only thing that matters is whether the path you end up submitting is a path to a directory (bug) or to a file (OK).

  6. MaximoTrinidad commented on Jul 14, 2017

    @MaximoTrinidad

    Michael Klement (@mklement0),

    Thanks!

    Sorry for the confusion! I didn't meant the tab-completion was an issue. On the contrary, I won't have never spotted the bug because I either: I type the whole path, or type the path partially to then use Tab to complete the line.

    I see the bug!

    :)

  7. SteveL-MSFT commented on Jul 14, 2017

    @SteveL-MSFT
    Member

    This is a regression in corefx. Apparently this is by-design for corefx as this relies on ShellExecute to work on Windows and it's false by default in corefx for cross plat reasons. I'll address this in PowerShell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-BugResolution-FixedWG-Cmdlets

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions