Is there a possibility to dynamically add the .ps1 filename to the scripts help section?
I am trying to put examples in the help section of my script and always show the current filename, in case a customer changes it.
Like this:
<#
.EXAMPLE
.\$name -param1 xxx
\#>
and if i run
get-help .\my_script.ps1 -examples
the output should look like
EXAMPLE
.\my_script.ps1 -param1 xxx
I am not sure if this is possible inside of a comment
but get-help has the possibility to detect the filename
if you run
get-help .\filename.ps1
its name is added to the syntax section
you could also run
get-help .\filename.ps1 | select *
and you'll see that the name is part of the output so maybe this is usable somehow?
thanks