Search code examples
powershellpowershell-5.0

PowerShell HelpNotFoundException: could not find forfiles in a help file in this session


I am using PowerShell version 5.1, build 15063, revision 138.

When I try to access the manual page for the forfiles command using help, I get an error that looks like this:

Enter image description here

I have tried running Update-Help as administrator. I also tried running it with the options recommended by this question, but still PowerShell finds nothing.

I know I can access the documentation for forfiles here, but that sort of defeats the purpose of the help command. I'm also worried there is some deeper configuration issue with my machine or OS that is causing this and that it will cause other problems down the line.

Any ideas?


Solution

  • forfiles.exe is an external utility - a binary executable unrelated to PowerShell - so it is not covered by PowerShell's help system.

    You can invoke forfile.exe's command-line help as follows:

    forfiles /?
    

    In order to determine what type of command a given name refers to, use the Get-Command cmdlet:

    > Get-Command forfiles
    
    CommandType     Name                                               Version    Source                                                                           
    -----------     ----                                               -------    ------                                                                           
    Application     forfiles.exe                                       10.0.14... C:\WINDOWS\system32\forfiles.exe                                                 
    

    As you can see, the .CommandType property of the object returned by Get-Command indicates the command's type.

    Use the -All switch if there's a chance that a given name can refer to multiple commands - the one that will take effect when referenced by name only will be listed first.


    As for what kinds of commands / topics PowerShell's Get-Help command does cover:

    • Alias
    • Cmdlet
    • Provider
    • General
    • FAQ
    • Glossary
    • HelpFile - these are the conceptual help topics whose names match about_*
    • ScriptCommand
    • Function
    • Filter
    • ExternalScript
    • All
    • DefaultHelp
    • Workflow
    • DscResource
    • Class
    • Configuration

    Note: These are the values that the Get-Help cmdlet's -Category parameter accepts, as reflected in Get-Helps syntax diagram, as shown by Get-Help -?,

    Not all categories will have actual topics associated with them, but you can query a given category with
    Get-Help -Category <categoryName>