批处理文件:密码星/圈

时间:2009-05-27 16:37:10

标签: batch-file passwords

就像你已经知道的那样,网站有一些特殊的密码字符,如星星和圆圈。

这可以在批处理文件中实现,如下所示:?

如果这不可能,如果你输入,你能看到什么吗?

set pass=
set /p pass=Enter your password: 
if {%pass%}=={} goto :begin
set authenticated=
for /f "tokens=*" %%a in (pass.txt) do (
    if {%%a}=={%pass%} set authenticated=true
)
if not defined authenticated (echo Invalid password & goto :begin)

但我需要明白这一点:

for /f "delims=" %%i in ('cscript /nologo GetPwd.vbs') 

HOW!

5 个答案:

答案 0 :(得分:3)

不直接。您必须在其他地方编写密码输入程序,然后从批处理文件中运行它以捕获密码。

答案 1 :(得分:1)

这里给出了几种实现这一目标的方法:Can I mask an input text in a bat file。此外,也许有人将此标记为副本?

答案 2 :(得分:1)

另一种选择是我的EditV32(x86)或EditV64(x64)命令行工具。例如:

editv32 -m -p“密码:”PWD

-m表示“屏蔽输入”,-p表示提示。用户的输入存储在PWD环境变量中。你可以在这里得到它:

http://www.westmesatech.com/editv.html

答案 3 :(得分:0)

How to create a masked input to a batch file - 这有帮助吗?根据平台的不同,它似乎有所不同。

答案 4 :(得分:0)

完成了它:

批处理文件:

@echo off
<nul: set /p passwd=Password: 
for /f "delims=" %%i in ('cscript /nologo GetPwd.vbs') do set passwd=%%i

GetPwd.vbs:

Set oScriptPW = CreateObject("ScriptPW.Password")
strPassword = oScriptPW.GetPassword()
Wscript.StdOut.WriteLine strPassword