Page 1 of 1

Hiding Characters

Posted: Sat Jan 09, 2010 1:34 pm
by someguy
Heres my script so far:

Code: Select all

@echo off
:a
set /p input=Name:
if %input%==Name goto b else goto c

:b
set /p pass=Password:
if %pass%==Pass goto d else goto c

:c
echo wrong
sleep 1
exit

:d
echo right
sleep 1
exit
so is there a way to hide whatever they type after "Name:" and "Password:"?

Hiding Characters

Posted: Sat Jan 09, 2010 2:06 pm
by jvierra
Not with a command line bat file.

You can do that with PowerShell and mosy other scripting languages.

Look for third party add-ons for the command line. Some may still be around although there is not much going on with the old DOS things anymore.

YOu can put teh following in a file with a vbs extension and get a password with no echo:

Code: Select all

	
Set oPW = CreateObject( "ScriptPW.Password" )
WScript.StdOut.Write "Enter password:"
sPW = oPW.GetPassword()
WScript.Echo vbCrLf & "You entered:" & sPW
	



See also:
http://blogs.technet.com/heyscriptinggu ... utbox.aspx


Hiding Characters

Posted: Sun Jan 10, 2010 1:18 am
by someguy
Thanks!