views:

720

answers:

5

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!

+1  A: 

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
I hope you could still.
YourComputerHelpZ
SOMEBODY ELSE PLEASE TELL ME ITS POSSIBLE
YourComputerHelpZ
and... if you type it in, but just see nothing?
YourComputerHelpZ
I don't see how it COULD be possible given the lack of control batch files give you over processing the standard input stream.
Daniel Straight
+1  A: 

Several ways of accomplishing this are given here: http://stackoverflow.com/questions/664957/can-i-mask-an-input-text-in-a-bat-file. Also, maybe someone marks this as a duplicate?

Iceman
+1  A: 

Hi all, 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:

www.westmesatech.com/editv.html

Regards, Bill

AbqBill
Thanks, this is a very easy way to do it.
YourComputerHelpZ
A: 

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

ldigas
When i run it, it says 'choice command not found'
YourComputerHelpZ
A: 

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
YourComputerHelpZ