windows batch command to determine working directory of a process

后端 未结 3 1012
予麋鹿
予麋鹿 2020-12-16 17:12

Why I ask is that my program uses 3rd party software that sometimes leaves behind orphan processes that have no link back to my program or the 3rd party process. These orph

3条回答
  •  余生分开走
    2020-12-16 17:44

    The following will work, though you only need "CommandLine" or "ExecutablePath" - not both:

    wmic process where "ProcessID=1111" get CommandLine, ExecutablePath
    

    It will return something like the following, showing where the program for PID 1111 is running:

    "C:\Program Files (x86)\Common Files\MyProgram\Agent\agent.exe"
    

提交回复
热议问题