James Brown
James Brown

Reputation: 347

PowerShell function won't load in profile

I'm using this function:

function help { get-help $args[0] -detailed | less }

When I enter this into the PowerShell console, it behaves correctly. But when I save this in my profile and reload it, the 'help' command correctly uses 'less' but does not display the help topic as -detailed, only the standard short view.

Am I missing something obvious? Thank you.

Upvotes: 1

Views: 267

Answers (1)

Keith Hill
Keith Hill

Reputation: 201622

Are you defining your help function in your profile before importing a module that might be overwriting your function? For example, the PowerShell Community Extensions module defines a help function. If you import it after you have defined yours, then it wins. To fix, move your function definition to the end of your profile.

Upvotes: 1

Related Questions