@ECHO off
$BIOS= Get-WmiObject -computername "BAHRIATSG2-PC" -Namespace
root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface
$BIOS.SetBIOSSetting('Setup Password','<utf-16/>TheBIOSPassword','<utf-16/>')
pause
當我保存爲.bat文件並運行它不工作,否則它在PowerShell中工作正常,當我手動輸入..如何在批處理文件中運行PowerShell命令
[如何從批處理文件運行PowerShell腳本](https://stackoverflow.com/questions/19335004/how-to-run-a-powershell-script-from-a-batch-file ) – arco444
我不確定重複的問題是否可以解釋它。您需要將您的腳本保存爲.ps1文件,然後您可以從.bat腳本執行它,如上述鏈接問題中所述。 –
[如何從批處理文件執行powershell命令?](https://stackoverflow.com/questions/6037146/how-to-execute-powershell-commands-from-a-batch-file) –