Prompt screen tip or tool tip on console

Himanshuk 161 Reputation points
2021-02-23T08:14:49.697+00:00

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
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,577 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 111.8K Reputation points MVP
    2021-02-23T08:34:42.187+00:00

    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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.