how can i mask input by using batch file without e

2019-02-20 16:13发布

问题:

i want batch file to mask the input with * without extra file

For example

http://pastebin.com/2c4EtG4g

this code is working successfully but it is very slow when i write the letter can any one give my

code is fast and without an extra file ? or edit the code in the link to be fast ??

回答1:

Does this meet your "no extra file" criterion?

It's a batch file that creates and deletes a tool to get the input, and so it is completely portable, and works in 64 bit machines too.

Herbert Kleebauer wrote the utility and source code can be found on Usenet.

It requires Vista and later I think.

Newsgroups: alt.msdos.batch.nt
Subject: Re: HInput.cmd (new version)
Date: Mon, 25 Feb 2013 19:08:59 +0100

@echo off
certutil -f -decode %~f0 pass.exe>nul
set /p =Enter password: <nul
for /f %%i in ('pass.exe') do set password=%%i
echo.
echo %password%
del pass.exe
pause
goto :eof
-----BEGIN CERTIFICATE-----
TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0byBtZWV0IHNvbWVi
b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgaGlzIHByb2dyYW0gcmVx
dWlyZXMgV2luMzIuDQokAFBFAABMAQEAUHmlNgAAAAAAAAAA4AAPAQsBBQwAAgAA
AAAAAAAAAADIEAAAABAAAAAgAAAAAEAAABAAAAACAAAEAAAAAAAAAAQAAAAAAAAA
ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEAAAAAAAAAAAAAAA
HBAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAcAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAADkBQAAABAAAAACAAAAAgAA
AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABuEAAAfBAAAIwQAACYEAAA
pBAAALYQAAAAAAAAUhAAAAAAAAAAAAAARBAAAAAQAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAEtFUk5FTDMyLmRsbAAAbhAAAHwQAACMEAAAmBAAAKQQAAC2EAAAAAAAAAAA
RXhpdFByb2Nlc3MAAABHZXRTdGRIYW5kbGUAAAAAUmVhZEZpbGUAAAAAV3JpdGVG
aWxlAAAAR2V0Q29uc29sZU1vZGUAAAAAU2V0Q29uc29sZU1vZGUAAOiDAAAAPA10
DuguAAAAsCroCAAAAOvp/xUAEEAAUKLMFUAAMcADBdwVQAB1LGr0/xUEEEAAo9wV
QADrHVCizBVAADHAAwXYFUAAdQ1q9f8VBBBAAKPYFUAAagBo4BVAAGoBaMwVQABQ
/xUMEEAACcB1CGoA/xUAEEAAgT3gFUAAAQAAAHXsWMMxwAMF1BVAAHU3avb/FQQQ
QACj1BVAAGjQFUAAUP8VEBBAAIAl0BVAAOH/NdAVQAD/NdQVQAD/FRQQQACh1BVA
AGoAaOAVQABqAWjMFUAAUP8VCBBAAAnAdQhqAP8VABBAAA+2BcwVQACBPeAVQAAB
AAAAdAW4/////8MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA==
-----END CERTIFICATE-----
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


回答2:

You can do like this :

EDIT :

  @Echo Off  
  :HInput    
  SetLocal DisableDelayedExpansion
Echo Enter your Code :
   Set "Line="
   For /F %%# In (
   '"Prompt;$H&For %%# in (1) Do Rem"'
   ) Do Set "BS=%%#"

  :HILoop
   Set "Key="
   For /F "delims=" %%# In (
   'Xcopy /W "%~f0" "%~f0" 2^>Nul'
   ) Do If Not Defined Key Set "Key=%%#"
   Set "Key=%Key:~-1%"
   SetLocal EnableDelayedExpansion
   If Not Defined Key Goto :HIEnd
  If %BS%==^%Key% (Set /P "=%BS% %BS%" <Nul
   Set "Key="
   If Defined Line Set "Line=!Line:~0,-1!"
   ) Else Set /P "=*" <Nul
   If Not Defined Line (EndLocal &Set "Line=%Key%"
   ) Else For /F delims^=^ eol^= %%# In (
   "!Line!") Do EndLocal &Set "Line=%%#%Key%"
  Goto :HILoop

  :HIEnd
   Echo(
Echo Your code is :  "!Line!"
   Pause
   Goto :Eof