question

FoxHD avatar image
0 Votes"
FoxHD asked ·

Prompt screen tip or tool tip on console

When user enter date for cmdlet

Get-log -date 2/31/2021

I want to prompt user to enter first MMM then /then dd then/ and yyyy while enter time only, how to show him screen tip

I can use validate script in parameter but then after user enter date and enter then only it's validating, to prevent user from entering wrong date how to show tool tip or screen tip while entering date?

windows-server-powershell
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered ·

Are you using Read-Host to get the user input?
If so: As far as I know there is no option for Tool Tip or validation of the input while typing.
Only simple way is to add a short hint in the -Prompt

 $date = Read-Host -Prompt 'Input date (format MM/DD/YYYY)'
 $date


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.