I want to display in a browser the load percentage of a cpu trough php. This is the code I am using:
$command ="C:\\wmic cpu get loadpercentage";
echo shell_exec("$command 2>&1 ; echo $?" );
This is the output:
'C:\wmic' is not recognized as an internal or external command, operable program or batch file.
What am I missing?
Update - 1
Change the code to allow spaces between words:
$command ="C:\\wmic^ cpu^ get^ loadpercentage";
'C:\wmic cpu get loadpercentage' is not recognized as an internal or external command, operable program or batch file.
Now the entire line of code is being read, not only 'C:\wmic'