[PS] Misleading error message for get-childitem -Path parameter

Discussion in 'Scripting' started by Andrew Watt [MVP], May 15, 2006.

  1. Try

    get-childitem -Path c:\

    and it works nicely.

    Add an Include parameter,

    get-childitem -Path C:\ -Include *.txt

    and you get an error:

    PS C:\PowerShellScripts> get-childitem -Path C:\ -Include *.txt
    Get-ChildItem : Cannot process argument because the value of argument
    "path" is invalid.
    At line:1 char:14
    + get-childitem <<<< -Path C:\ -Include *.txt
    PS C:\PowerShellScripts>

    I have mentioned before that I think the error messages should refer
    to parameters.

    But the real issue is that a value for the Path parameter that is
    accepted in the first command is rejected in the second. The error
    message needs to be reviewed, I suggest.

    Andrew Watt MVP
     
    Andrew Watt [MVP], May 15, 2006
    #1
    1. Advertisements

  2. Please open a bug. The error message is misleading.
     
    Wei Wu [MSFT], May 15, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.