Reading Command Line Arguments of Another Process (Win32 C code)

后端 未结 5 1583
甜味超标
甜味超标 2020-12-16 02:41

I need to be able to list the command line arguments (if any) passed to other running processes. I have the PIDs already of the running processes on the system, so basically

5条回答
  •  醉酒成梦
    2020-12-16 03:35

    The cached solution: http://74.125.45.132/search?q=cache:-wPkE2PbsGwJ:windowsxp.mvps.org/listproc.htm+running+process+command+line&hl=es&ct=clnk&cd=1&gl=ar&client=firefox-a

    in CMD
    WMIC /OUTPUT:C:\ProcessList.txt PROCESS get Caption,Commandline,Processid
    
    or
    
    WMIC /OUTPUT:C:\ProcessList.txt path win32_process get Caption,Processid,Commandline
    

    Also: http://mail.python.org/pipermail/python-win32/2007-December/006498.html

    http://tgolden.sc.sabren.com/python/wmi_cookbook.html#running_processes 
    seems to do the trick:
    
    import wmi
    c = wmi.WMI ()
    for process in c.Win32_Process ():
      print process.CommandLine
    

提交回复
热议问题