Skip to content

Feature Request: Add suggestions for common cmd.exe commands #9006

Closed

Description

Summary of the new feature/enhancement

Users trying to move from cmd to PowerShell struggle with muscle memory on commands like dir /s which don't work since dir is an alias to get-childitem and parameters start with a hyphen and /s for subdirectories would need to be -r for recursion.

Proposed technical implementation details (optional)

Have a built in list of common cmd built-in commands and when the user tries it, a CommandNotFoundException is thrown the suggestion framework can suggest the PowerShell equivalent.

Activity

  1. iSazonov commented on Feb 28, 2019

    @iSazonov
    Collaborator

    Can MSFT use telemetry to collect such errors? This would greatly facilitate the work (and make it "portable" - Unix users haven't such problems?).

  2. SteveL-MSFT commented on Feb 28, 2019

    @SteveL-MSFT
    MemberAuthor

    Ilya (@iSazonov) feel free to add that to PowerShell/PowerShell-RFC#158

    We've discussed getting telemetry on errors as it would tell us what issues customers are having but there are privacy concerns of the contents of the ErrorRecord

  3. iSazonov commented on Mar 1, 2019

    @iSazonov
    Collaborator
  4. iSazonov commented on Mar 1, 2019

    @iSazonov
    Collaborator

    Perhaps it is good area for (local) ML/AI.

  5. rkeithhill commented on Aug 7, 2020

    @rkeithhill
    Collaborator

    Could we also get suggestions for common native exes on Windows? I should get suggestions when I mis-type git, bash, npm, python, gcc, node, etc. Today the experience isn't very helpful on Windows:

    08-07 14:50:32 7> npn run build
    npn: The term 'npn' 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.
    
    Suggestion [4,General]: The most similar commands are: nsn, cp, cpi, gp, gpv, gps, mp, nal, ndr, ni.
    [user/hill/ULC-3286-impl-install-license-service-stub +0 ~7 -0 !] KLM:src\KeysightLicenseManager
    !08-07 14:50:38 8> gir fetch 
    gir: The term 'gir' 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.
    
    Suggestion [4,General]: The most similar commands are: dir, gdr, gi, gin, gip, gal, gbp, gc.
    

    NOTE: suggestions work better on Linux for some reason:

    08-07 15:02:33 4> npn run build
    npn: The term 'npn' 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.
    
    Suggestion [4,General]: The most similar commands are: nsn, npm, npx, cpi, gp, gpv, gps.
    /home/hillr
    08-07 15:03:47 5> gir fetch
    gir: The term 'gir' 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.
    
    Suggestion [4,General]: The most similar commands are: dir, gdr, gi, git, gal, gbp, gc, gci, gcm.
    /home/hillr
    

    🤷‍♂️

  6. iSazonov commented on Nov 30, 2021

    @iSazonov
    Collaborator

    It would be great to have more meta data about Windows utilities in a format that we could use in IntelliSense, argument binding and so on.

  7. theJasonHelmick commented on May 26, 2022

    @theJasonHelmick
    Collaborator

    After discussing wit the working group, we feel this is a very specific scenario that can cause additional confusion with users scripting commands. This also would not necessarily prevent similar usage errors from occurring unless all the parameters for a command are resolved to - parameters. One area we think this might be considered is with the suggestion framework, however it doesn't resolve the problem of incorrect usage in scripts. Error will still be produced. The current error produced form Dir /s is very explanatory.

  8. ghost closed this as completedon May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-DeclinedThe proposed feature is declined.WG-Enginecore PowerShell engine, interpreter, and runtimeWG-Interactive-IntelliSensetab completion

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions