cmdletbinding / compiled ps1

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 2 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
yves22
Posts: 23
Last visit: Tue Jan 02, 2024 4:12 am
Been upvoted: 1 time

cmdletbinding / compiled ps1

Post by yves22 »

Hello,

Is there a way to keep the cmdletbinding when you compiled a ps1 script.

get-help [your_script.ps1] -full
can be
your_script.exe /?

I suppose that there is no way, but I hope there is one !

Sincerly yours
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: cmdletbinding / compiled ps1

Post by brittneyr »

When a script is packaged as an executable, it no longer runs as a 'normal' script. You can add a parameter to your package script to show help. All functionality from cmdletbinding can also be handled.
You may find the following helpful:
https://www.sapien.com/blog/2015/11/30/ ... able-file/
https://www.sapien.com/blog/2015/12/07/ ... able-file/
Brittney
SAPIEN Technologies, Inc.
User avatar
yves22
Posts: 23
Last visit: Tue Jan 02, 2024 4:12 am
Been upvoted: 1 time

Re: cmdletbinding / compiled ps1

Post by yves22 »

thanks so much for this usefull and quick answer !!

Best regards,
This topic is 2 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked