Skip to content

Instantly share code, notes, and snippets.

@egre55
Last active July 16, 2024 13:03

Revisions

  1. egre55 revised this gist Oct 1, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion procmon.bat
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    REM ugly file-based process monitor script
    REM Ugly file-based process monitor script. Non-PowerShell in case blocked

    @echo off

  2. egre55 created this gist Oct 1, 2018.
    18 changes: 18 additions & 0 deletions procmon.bat
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    REM ugly file-based process monitor script

    @echo off

    :loop

    del file1.txt 2> nul
    del file2.txt 2> nul

    for /f "usebackq skip=1 tokens=* delims= " %%i in (`wmic path win32_process get commandline ^| findstr /r /v "[^\ ]"`) do echo %%i >> file1.txt

    ping -n 1 127.0.0.1 >nul

    for /f "usebackq skip=1 tokens=* delims= " %%i in (`wmic path win32_process get commandline ^| findstr /r /v "[^\ ]"`) do echo %%i >> file2.txt

    fc file1.txt file2.txt | findstr /r "[abcdefghijklmnopqrstuvwxyz]" | findstr /v "ECHO" | findstr /v "*****" | findstr /v "Comparing" | findstr /v "wmic" | findstr /v "FC:"

    goto loop