Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个简单的批处理文件来启动程序。
我使用什么命令让批处理文件首先检查(自动)以查看程序是否正在运行,如果程序尚未运行,则运行该程序?
[[在此先感谢,我已经看过了,但似乎找不到答案。]]
尝试这个:
TASKLIST /FI "IMAGENAME eq processName.exe" /FI "status eq running" | find /I /N "processName.exe">NUL IF ("%ERRORLEVEL%"=="0" echo Process is running) ELSE (start "processName.exe")