1

Like you already know, websites have certain special chars for passwords, like stars and circles.

Could this be possible in a batch file, on the following one:?

If this is not possible, if you type it in, could you just see nothing?

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)

But i need to get this in it:

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

HOW!

Deniz Zoeteman
  • 9,691
  • 26
  • 70
  • 97
  • possible duplicate of [What would be the Windows batch equivalent for HTML's input type="password"?](http://stackoverflow.com/questions/286871/what-would-be-the-windows-batch-equivalent-for-htmls-input-typepassword) – Helen Sep 09 '10 at 18:03
  • 1
    Possible duplicate of [Can I mask an input text in a bat file](http://stackoverflow.com/questions/664957/can-i-mask-an-input-text-in-a-bat-file) – SomethingDark Apr 29 '16 at 02:16

5 Answers5

3

Not directly. You would have to write a password entry programme in something else and then run it from your batch file to capture the password.

ConcernedOfTunbridgeWells
  • 64,444
  • 15
  • 143
  • 197
1

Several ways of accomplishing this are given here: Can I mask an input text in a bat file. Also, maybe someone marks this as a duplicate?

Community
  • 1
  • 1
Kevin
  • 8,353
  • 3
  • 37
  • 33
1

another alternative is my EditV32 (x86) or EditV64 (x64) command-line tools. For example:

editv32 -m -p "Password: " PWD

-m means "masked input" and -p is the prompt. The user's input is stored in the PWD environment variable. You can get it here:

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

Bill_Stewart
  • 22,916
  • 4
  • 51
  • 62
0

How to create a masked input to a batch file - does that help ? It appears to vary somewhat depending on the platform.

Rook
  • 60,248
  • 49
  • 165
  • 242
0

Got it done:

Batch file:

@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
Deniz Zoeteman
  • 9,691
  • 26
  • 70
  • 97