是否有可能在cmd中使用shadowtype?

时间:2017-06-18 17:42:49

标签: batch-file cmd

非常直截了当的问题。是否可以在cmd中进行阴影键入? (我的意思是在没有显示你输入内容的情况下输入cmd窗口)例如,当您为具有ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| html_tag.html_safe end 的用户设置密码时。是否有可能通过命令来模仿它?

1 个答案:

答案 0 :(得分:0)

我制作的100%批量解决方案,接受退格键删除字符,接受输入密钥以验证密码并自动计算密码长度。

@echo off&cls

::The password
set "$Mdp=toto1234"

::La longeur du Mot de passe
set "$Long=-1"
for /F "delims=" %%c in ('cmd /D /U /C echo %$Mdp% ^| find /V ""') do (set /a $Long+=1)

::Les autres variables
set "$l="
set "$l1="
set "$C=0"

:test
if %$c%==%$Long% goto:Pastrouve
set "$T="
cls&echo Entrer votre MDP : %$l1%
For /F "delims=" %%# In ('Xcopy /W "%~f0" "%~f0" 2^>Nul') Do If Not Defined $T Set "$T=%%#"

set "$testenter=%$T:~-1%"
if not defined $Testenter goto:Pastrouve

if %$T:~-1%== (
 if not %$C%==0 (
  Set "$l=%$l:~0,-1%"
  set "$l1=%$l1:~0,-1%"
  set /a $C-=1)
 ) else (
  Set "$l=%$l%%$T:~-1%"
  set "$l1=%$l1%*"
  set /a $C+=1)

if "%$l%"=="%$Mdp%" goto:trouve
goto:test

:trouve
echo Pass OK 
Pause >NUL & exit/b

:Pastrouve
echo PASS NOT OK
Pause>NUL & exit/b

同样使用BAT / Powershell

@echo off&cls
set $MDP=toto1234
for /f "delims=" %%a in ('powershell -c "$rep=read-host Entrer_votre_MDP -AsSecureString;$password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($rep));write $password"') do set $rep=%%a

if %$MDP%==%$rep% (echo PASS OK) else (echo PASS NOT OK)
exit/b