1
我已經批量創建了一個程序,要求輸入密碼才能繼續執行程序的下一部分。我有一個我創建的包含密碼的文件。在程序中,我會調用該文本文件的內容並將其設置爲「密碼」變量...唯一的問題是,我收到錯誤消息:'The File is being Used在另一個過程'在另一個進程中使用的文件錯誤在批處理
我已經做了一些研究,並指出有時一些代碼行不是必需的,並導致發生此錯誤。難道這就是
這是我已經找到了一個錯誤我的代碼的一部分:
for /F "delims=" %%i in (Password.txt) do set content=%%i echo %content% set password123=%content%
powershell -Command $pword = read-host "Enter password" -AsSecureString ;^$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword) ;^[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) > .tmp.txt
set /p password=<.tmp.txt & del .tmp.txt
if %password123%=%password% goto :correct
if not %password123%=%password% goto :incorrect
感謝您的時間提前!