What would be the Windows batch equivalent for HTML's input type=“password”?

前端 未结 12 2142
有刺的猬
有刺的猬 2020-12-01 18:51

I need to get authentication credentials from the users within a Windows script but the classic \"first Google result\" approach:

SET /P USR=Username: 
SET /         


        
12条回答
  •  情书的邮戳
    2020-12-01 19:38

    I wrote an open-source tool called editenv that replaces my older editv32/editv64 utilities:

    https://github.com/Bill-Stewart/editenv

    It provides the --maskinput (-m) option[*] that lets you hide the typed input. Example:

    editenv -m -p "Password: " PWD
    

    This command displays a Password: prompt, and whatever you enter is placed in the PWD environment variable.

    Download here:

    https://github.com/Bill-Stewart/editenv/releases

    [*] Note that the --maskinput (-m) option is not secure -- typed input is placed in plain-text in the environment. This feature is for convenience only.

提交回复
热议问题