【发布时间】:2016-06-14 15:07:05
【问题描述】:
我的命令和我得到的错误如下。我已经尝试了所有我能想到的引号、大括号和反引号的组合。有谁知道如何让它工作?
PS C:\Windows\system32> powershell.exe -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None -Command " & {(Get-WmiObject -Class win32_service -Filter "name='MSSQLSERVER'").StartName}"
Get-WmiObject : 无效查询 "select * from win32_service where 名称 = MSSQLSERVER" 在行:1 字符:6 + & {(Get-WmiObject -Class win32_service -Filter name=MSSQLSERVER).StartName} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ManagementException + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
【问题讨论】:
标签: powershell