2013-10-13 119 views
0

这是这个问题我也问过这个SE How to run a PowerShell script from a batch file。我的延续已经使用PowerShell来执行此命令警告在执行PowerShell脚本

$query = "SELECT * FROM Win32_DeviceChangeEvent WHERE EventType = 2" 
Register-WMIEvent -Query $query -Action { invoke-item "C:\Program Files\abc.exe"} 

我已成功执行了powersell剧本,但我得到这个警告。 enter image description here

你能告诉我怎样才能解决这个问题,

+0

你尝试过明确声明其列你想显示? – ermagana

回答

2

管道命令Format-List或尝试:

Register-WMIEvent -Query $query -Action { invoke-item "C:\Program Files\abc.exe"} | Format-List 

Register-WMIEvent -Query $query -Action { invoke-item "C:\Program Files\abc.exe"} | Format-Table -Auto 
+0

这两个查询都不起作用状态为“未启动” – Eka

+1

您也可以尝试将控制台的大小调整为120个字符。 :-) –

+0

我非常抱歉,但我是新的PowerShell,我不明白通过调整控制台的大小?使用你的上面的脚本,我得到了这个消息http://i43.tinypic.com/23t087n.png – Eka