| The Code for: "Process (TASK) Information[using PV.exe].cmd" |
This is the example, a shortcut was installed to this code :
@echo off ::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ :: $Header: C:/DBAREIS/Projects.PVCS/Win32/ScriptingTipsAndTricks/EXAMPLE[cmd].Process (TASK) Information[using PV.exe].cmd.pvcs 1.0 29 Jun 2014 12:51:22 USER "Dennis" $ ::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ setlocal call :PvExe "ProcessInfo.Specific Tasks.tsv" "300" "outlook.exe EXCEL.EXE WINWORD.EXE" call :PvExe "ProcessInfo.tsv" "2000" "" goto :EOF ::++++++++++++++++++ :PvExe ::++++++++++++++++++ :: =============================================================== :: === PV.EXE Command line ======================================= :: =============================================================== :: - %n image name :: - %m memory (K) :: - %i process id :: - %r parent id :: - %t thread count :: - %d creation time :: - %e elapsed cpu time :: - %c[time] % cpu :: - %u user name :: - %l command line :: - PV.EXE -o"%n\t%i\t%r\t%t\t%d\t%e\t%c%CpuMonitorMsToMonitorCpu%%%\t%mK\t%u\t%l" outlook.exe :: =============================================================== set ProcessFile=%~1 set MsToMonitorCpu=%~2 set These=%~3 if "%TAB%" == "" call :SetChar TAB 9 set HdrLine=PgmName%TAB%Memory (K)%TAB%PID%TAB%PPID%TAB%Thread Count%TAB%Start Time set HdrLine=%HdrLine%%TAB%Elapsed CPU Time%TAB%Percent CPU%TAB%User Name%TAB%Command Line echo %HdrLine%> "%ProcessFile%" 2>&1 PV.EXE -o"%%n\t%%mK\t%%i\t%%r\t%%t\t%%d\t%%e\t%%c%MsToMonitorCpu%%%%%\t%%u\t%%l" %These% >> "%ProcessFile%" 2>&1 type "%ProcessFile%" goto :EOF @REM **************[v08.178]****************** :SetChar @REM ***************************************** set VbsFile=%TEMP%\SetChar-%random%.vbs set CmdFile=%TEMP%\SetChar-%random%.cmd echo if Wscript.Arguments.Count ^<^> 2 then > "%VbsFile%" echo wscript.echo "REM Invalid parameters, expected 2 (1=EnvVar 2=AsciiCode), got " ^& Wscript.Arguments.Count >> "%VbsFile%" echo else >> "%VbsFile%" echo wscript.echo "@echo off" >> "%VbsFile%" echo wscript.echo "SET " ^& Wscript.Arguments(0) ^& "=" ^& chr(Wscript.Arguments(1)) >> "%VbsFile%" echo end if >> "%VbsFile%" cscript.exe //NoLogo "%VbsFile%" "%~1" "%~2" > "%CmdFile%" call "%CmdFile%" del "%VbsFile%" >nul 2>&1 del "%CmdFile%" >nul 2>&1 goto :EOF
Please note that that I am not trying to show how great I am by producing batch files 9,000 characters long on one line that no one will understand or be able to debug when they go wrong. I am going out of my way to comment the code and make it verbose so beginners and advanced users will both benefit. I don't claim to be an expert that knows everything, if I'm wrong or make a mistake then please contact me and let me know :-)
![]() | ![]() |