Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

CLI: Ambiguous parameter names such as -no are misinterpreted as positional parameter values #4351

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Steps to reproduce

# -no is ambiguous: could be -NoProfile, -NoLogo, ...
powershell -no -command get-date

Expected behavior

An error complaining about the ambiguity of the parameter name and refusal to continue.

Actual behavior

PS Core and Windows PS behave differently, due to the recent Core change to default to -File instead of -Command:

  • PowerShell Core:
The argument '-no' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
PowerShell v6.0.0-beta.4
Copyright (C) Microsoft Corporation. All rights reserved.
  • Windows PowerShell:
-no : The term '-no' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ -no -command get-date
+ ~~~
    + CategoryInfo          : ObjectNotFound: (-no:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Environment data

PowerShell Core v6.0.0-beta.4 on macOS 10.12.5
PowerShell Core v6.0.0-beta.4 on Ubuntu 16.04.2 LTS
PowerShell Core v6.0.0-beta.4 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Windows PowerShell v5.1.15063.413 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Reactions are currently unavailable

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.