Well the command I'm trying to run is powershell.exe (Get-Counter -Counter '\Processor(_Total)\% Processor Time' -MaxSamples 1).CounterSamples[0].CookedValue. I'm already seperating the program to execute and the parameter with the colon so I believe the colon should not be escaped. When I run the escaped version it will throw an exception which is what i'd expect.
ERROR 2012-11-25 19:07:34.137 [kg.apc.p] (): Problems executing: powershell.exe:(Get-Counter -Counter '\Processor(_Total)\% Processor Time' -MaxSamples 1).CounterSamples[0].CookedValue
java.io.IOException: Cannot run program "powershell.exe:(Get-Counter -Counter '\Processor(_Total)\% Processor Time' -MaxSamples 1).CounterSamples[0].CookedValue": CreateProcess error=2,
The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at kg.apc.perfmon.metrics.ExecMetric.getValue(ExecMetric.java:31)
at kg.apc.perfmon.PerfMonMetricGetter.getMetricsLine(PerfMonMetricGetter
.java:114)
at kg.apc.perfmon.PerfMonWorker.sendToUDP(PerfMonWorker.java:309)
at kg.apc.perfmon.PerfMonWorker.processSenders(PerfMonWorker.java:277)
at kg.apc.perfmon.PerfMonWorker.run(PerfMonWorker.java:243)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find th
e file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 9 more