有谁知道为什么这不起作用
imap.closeBox(true);
答案 0 :(得分:1)
更像这样:
@echo off
set /p "pass=enter password> "
If "%pass%"=="#####" (goto :passed)
exit
:passed
echo "it worked"
答案 1 :(得分:0)
我不确定你要做什么
如果您尝试检查密码是否为####'并验证使用此
@echo off
SET /p pass="enter password>" REM change this to get it to work
IF "%pass%"=="####" (
GOTO passed
) ELSE (
EXIT
)
:passed
echo "it worked"
你没有设置变量Pass here,
如果你想检查名为####的文件并运行:如果文件存在则传递然后使用此代码虽然我认为这不是你尝试过的
@echo off
SET /p %pass%="enter password>" REM change this to get it working
IF EXIST %pass%="####" (goto :passed)
EXIT
:passed
echo "it worked"
答案 2 :(得分:0)
如果您还希望使用*******
您可以尝试此批处理文件:
@echo off
Title %~n0 by Hackoo 2016
Mode 50,5 & Color 0E
:CreatePassword
cls & Color 0E
setlocal DisableDelayedExpansion
Call :InputPassword "Please choose your password" pass1
Call :InputPassword "Please confirm your password" pass2
setlocal EnableDelayedExpansion
If !pass1!==!pass2! ( Goto:Good ) Else ( Goto:Bad )
::***********************************
:InputPassword
Cls
echo.
echo.
set "psCommand=powershell -Command "$pword = read-host '%1' -AsSecureString ; ^
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
for /f "usebackq delims=" %%p in (`%psCommand%`) do set %2=%%p
Goto :eof
::***********************************
:Good
Color 0B
Cls
echo.
echo Good password
::TimeOut /T 2 /NoBreak>nul
echo Your password stored as : "!Pass2!" without quotes
pause>nul
Goto :Eof
::***********************************
:Bad
Color 0C
Cls
echo.
echo Wrong password try again
::TimeOut /T 2 /NoBreak>nul
echo Press any key to retry again
pause>nul
Goto :CreatePassword
::***********************************