Introduction: Hide Password in Batch File
Do you need to type secret information in to a batch file but only see stars here is the file to do it!
Step 1: The Code
Here is the code copy between the xxxxxxxxxxxx's
SetLocal EnableExtensions EnableDelayedExpansion
Set /P "=Enter a Password:" < Nul
Echo(Your input was:!Line!
::Author: Carlos Montiers Aguilera
::Last updated: 20150401. Created: 20150401.
::Set in variable Line a input password
For /F skip^=1^ delims^=^ eol^= %%# in (
'"Echo(|Replace.exe "%~f0" . /U /W"') Do Set "CR=%%#"
For /F %%# In (
'"Prompt $H &For %%_ In (_) Do Rem"') Do Set "BS=%%#"
Set "CHR=" & For /F skip^=1^ delims^=^ eol^= %%# in (
'Replace.exe "%~f0" . /U /W') Do Set "CHR=%%#"
If !CHR!==!CR! Echo(&Goto :Eof
If !CHR!==!BS! (If Defined Line (Set /P "=!BS! !BS!" Set "Line=!Line:~0,-1!"
) Else (Set /P "=*" If !CHR!==! (Set "Line=!Line!^!"
) Else Set "Line=!Line!!CHR!"
Step 2: The Code Explained
The code will allow you to enter a password then this password will be displayed on the screen to change this remove echo !line!
Please view the rest of my work here
Or more of my batch file tutorials here
And get windows Xp FREE LEGALY from Microsoft here
We have a be nice policy.
Please be positive and constructive.