Windows script to achieve "if a program is running, do nothing, if it is not running, start it"?

assume that the target program is abc.exe and runs with the parameter -a xxx-b xxx , so how do you implement this script?
power shell and normal cmd are both fine.

Mar.26,2021

I don't think you need to write a single line of code, but use the service management that comes with windows to implement it.

registering your program as a windows service can either boot or hang up and start automatically.


tasklist|find /i "abc.exe"
if %errorlevel% == 1 (start abc.exe "-a xxx -b xxx")
Menu