在 powershell 命令提示符中运行以下命令可以正常工作:
Get-Service "my_service"
*output*
Status Name DisplayName
------ ---- -----------
Running my_service My_SERVICE
但是,如果按如下方式制作 ps1 scritp,我的输出不是我所期望的。
$my_service_check = Get-Service "my_service"
echo "My Service Status: $my_service_check"
*output*
my_service: System.ServiceProcess.ServiceController
为什么脚本不返回与命令相同的输出?
最佳答案
这是一个简单的:
echo "My Service Status:" $my_service_check
关于powershell - 为什么命令行执行与 powershell 中的脚本执行给出不同的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58449667/