How to run typeperf from batch file?
Andrew Henderson
How to run commands like
typeperf "\Process(*)\% Processor Time" -sc 1from batch file?
Ran from command line this command outputs something monstrous, while ran from bat file it prints
Error: No valid counters. 2 Answers
You need to double the percent sign. From
Using a percent sign (%) in a batch file requires that two percent signs (%%) be specified.
(...)
MS-DOS uses %1, %2, ... %9 as replaceable command line parameters. For example, before executing the command ECHO %1, %1 will be replaced with the first parameter passed to the batch file. %0 is replaced with the command used to execute the batch file.A single percent sign on a line is treated as a "nul" character in a batch file.
instead of using double % signs you could also use a config file for your counter settings like this:
tp.cfg:
\Processor(_Total)\% Processor Time
\Memory\Page Faults/secThen in your batch file call:
typeperf -cf "tp.cfg"