powershell - $Host.UI.Prompt() is ignoring the attribute 'DefaultValue' in FieldDescription -
powershell - $Host.UI.Prompt() is ignoring the attribute 'DefaultValue' in FieldDescription -
i trying user input, , homecoming default value if no input given.
i going $host.ui.prompt
, since according msdn ( pshostuserinterface.prompt method ) should provide functionality - or thought.
in short: $host.ui.prompt
method accepts collection of fielddescription
objects. each of objects can assigned defaultvalue
attribute, supposed returned when no input given user specific field.
i've got working desired, except default value part.
to see if messed script, tried illustration scripts internet, this one:
$host.ui.promptforchoice
works fine, value defaultchoice returned expected when create no choice.
$host.ui.prompt
won't provide assigned defaultvalue
s expected. like, default value not shown on prompt, , when nail come in without input given, empty/zero results.
interestingly enough, when run exact script in powergui, gui popup shows assigned defaultvalues proposed in according inputfield. seems work, $host.ui
object in powershell appears bugged in way...
i know can workaround this, don't want to. want understand why not doing it's not doing, because.
i running on windows 7 professional 64bit, latest updates.
here psversiontable:
name value ---- ----- psversion 4.0 wsmanstackversion 3.0 serializationversion 1.1.0.1 clrversion 4.0.30319.18444 buildversion 6.3.9600.16406 pscompatibleversions {1.0, 2.0, 3.0, 4.0} psremotingprotocolversion 2.2
i hope else here, preferably same setup, can seek verify & reproduce behaviour!
thanks in advance!
powershell input
Comments
Post a Comment