You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Sources/pyOpenRPA/Tools/RobotRDPActive/CMDStr.py

12 lines
565 B

import os # Get abs path of the file
# Create CMD str to run file if process.exe is not running
def ProcessStartIfNotRunning(inProcessName, inFilePath):
lFileAbsPath = os.abspath(inFilePath)
lResult = f'tasklist /nh /fi "imagename eq {inProcessName}" | find /i "{inProcessName}" > nul || (start {lFileAbsPath})'
return lResult
# Create CMD str to stop process
def ProcessStop(inProcessName, inFlagForceClose)
lResult = f'taskkill /im "{inProcessName}" /fi "username eq %USERNAME%"'
if inFlagForceClose:
lResult+= " /F"
return lResult