WMI(Windows Management Instrumentation) 사용법
WMIC : WMI command-line utility


//-------------------------------------
* 목표 질의 
    - 프로세스 시작 명령행에 포함된 문자열로 프로세스 검색

 

    - 예) 명령행에 some.bat 이 포함된 프로세스 찾기 
"SELECT CommandLine FROM Win32_Process WHERE CommandLine like '%some.bat%'"

    - PowerShell 
Get-WmiObject -Query "SELECT CommandLine FROM Win32_Process WHERE CommandLine like '%some.bat%'"

    - cmd.exe
wmic process where "name='cmd.exe' and CommandLine like '%some.bat%'" get CommandLine


//-------------------------------------
https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmic
https://superuser.com/questions/1003921/how-to-show-full-command-line-of-all-processes-in-windows

//-------------------------------------
wmic process where "name='cmd.exe'" get Caption,ProcessId,CommandLine

 

반응형
Posted by codens