@echo off
echo +==================================================+
echo ^|**********************Login***********************^|
echo +==================================================+
echo.
echo Login
setlocal DisableDelayedExpansion
set /p input=Username:
::powershell command
set "psCommand=powershell -Command "$pword = read-host 'Enter password' -AsSecureString ; ^
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
for /f "usebackq delims=" %%p in (`%psCommand%`) do set passwords=%%p
)
if %passwords% == 123 goto sucess
exit
END LOCAL
:sucess
cls
echo welcom back %Username%!
echo :)
pause
exit
我看到不同的
在powershell命令之前
I认为问题源于
chcp 65001
有效,即UTF-8代码页。
code Page
65001
powershell.exe
-windowspowershell-不幸的是,不幸的是,您描述了您所描述的症状:目前选择的字体已更改为遗产raster
limited gllyph(parnece)supports。
以下命令演示了问题(从
cmd.exe
运行):
:: Unexpectedly switches to a raster font.
:: Note: No longer occurs in PowerShell (Core) 7+, with pwsh.exe
chcp 65001 & powershell -noprofile -c "'hi'"
您可以使用以下一个工作之一:: 将您的批处理文件在Windows终端中删除,可在MicrosoftStore而不是在传统控制台窗口中使用。
您可以themantaly切换到代码页面
仍然支持您需要的所有字符;应用于上面的示例:
65001
您可以从Windows PowerShell切换到
,即按需按需跨平台后继版。它的cli不再表现出问题。