Inside a batch file, how can I tell whether a process is running?

后端 未结 2 1943
后悔当初
后悔当初 2021-01-02 14:21

I\'d like to write a batch file that checks to see if a process is running, and takes one action if it is, and another action if it isn\'t.

I know I can use tasklist

2条回答
  •  执念已碎
    2021-01-02 15:02

    Some options:

    • PsList from Microsoft

    http://www.windowsdevcenter.com/pub/a/oreilly/windows/news/win2kcommands_0401.html#ps

    • Cygwin (for ps)
    • the resource kit (for ps.vbs)

    http://www.windowsdevcenter.com/pub/a/oreilly/windows/news/win2kcommands_0401.html#ps

    • Powershell for get-process.

提交回复
热议问题