first I get the language info from registry
Code: Select all
(%regKeyRead_% $,"HKLM\SYSTEM\CurrentControlSet\Control\Nls\Language","InstallLanguage")3>nul 2>&3>&3&&(
%forQ_% ("§region.!$!") do set §lang=!%%~?!
)
then perform a lookup to get the country
Code: Select all
for %%? in (
"§region"
) do (
set "%%~?.0405=cz" &set "%%~?.0414=no" &set "%%~?.080C=be"
set "%%~?.0406=dk" &set "%%~?.0415=pl" &set "%%~?.0813=be"
set "%%~?.0407=gr" &set "%%~?.0416=br" &set "%%~?.0816=po"
set "%%~?.0409=us" &set "%%~?.0419=ru" &set "%%~?.0C0C=cf"
set "%%~?.040A=sp" &set "%%~?.041A=yu" &set "%%~?.1009=us"
set "%%~?.040B=su" &set "%%~?.041B=sl" &set "%%~?.100C=sf"
set "%%~?.040C=fr" &set "%%~?.041D=sv" &set "%%~?.0409=dv"
set "%%~?.040E=hu" &set "%%~?.0807=sg" &set "%%~?.040A=sp"
set "%%~?.040F=us" &set "%%~?.0809=uk" &set "%%~?.0C0C=cf"
set "%%~?.0410=it" &set "%%~?.080A=la" &set "%%~?.0409=us"
set "%%~?.0413=nl"
)
And then create the variable for supported languages.
Code: Select all
%forQ_% ( be, nl ) do if /I "!§lang!" == "%%~?" set "$cmd=Percentage processortijd"
%forQ_% ( us, uk ) do if /I "!§lang!" == "%%~?" set "$cmd=Processor Time"
Now I can use typeperf
Code: Select all
'typeperf.EXE "\Proces(*)\!$cmd!" -SC 1'
Squashman wrote:But we could get around that by using TYPEPERF /Q to get a valid counter.
When using the /Q option this is what I get
Code: Select all
C:\profSys\ADMIN>typeperf /Q Processor
\Processor(*)\Percentage processortijd
...
I see the text I am after, but will I be sure that 'Percentage processortijd' will always be the first result of typeperf /Q, and will object 'Processor' always be named 'Processor' ?