@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) –