PowerShell HelpMessage displayed by default in parameters -


is possible have powershell display messages default when parameters not specified in command line without user having input "!?" help?

should not use param , manualy instead read-host if want script interactive?

param (       [parameter(mandatory=$true,helpmessage="enter desired password.")][string]$desired_password,     [parameter(mandatory=$true,helpmessage="please input target hostnames.")][string[]]$target_hosts ) 

what best approach in such case?

if want text displayed if not specify [string] parameter, yes, have write yourself. example:

param(   [string] $testparameter )  if ( -not $testparameter ) {   write-host "this -testparameter."   while ( -not $testparameter ) {     $testparameter = read-host "enter value"   } }  "argument -testparameter: $testparameter" 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -