Close particular applications - Example Google Chrome application

You can use below script to close google chrome,

import subprocess;
process=subprocess.Popen([‘taskkill’, ‘/f’,‘/im’,‘chrome.exe’],shell=True,stdout=subprocess.PIPE);
result=process.communicate()[0]
print result

Note: You can close other applications by specifying relevant task name instead of ‘chrome.exe’ .

Sample output would be,