0

I am currently working on a program that will back up my Skype and iTunes data. It works fine with my iTunes data, however, when I try to backup files from Skype I get loads of errors. These are caused from the program still being open.

I thought it would be a fun little project to try and find out how to force quit a program (and then re-open).

I have successfully learned how to OPEN Skype (with a simple statement,

import os
os.startfile(path) #this opens programs. I need to close. 

So I think to get my program to work, all I would need to do is close skype, run the backup process, then re-open it.

When I tried searching my question, I was only finding answers to close PYTHON scripts. I need to close something that is running in Windows.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Kyle Me
  • 336
  • 2
  • 5
  • 13
  • http://stackoverflow.com/questions/6278847/is-it-possible-to-kill-a-process-on-windows-from-within-python – furas Jul 06 '14 at 22:59

1 Answers1

1

I have found the answer.

import os
os.system("taskkill /im skype.exe") #/im means "ImageName"

taskkill is a command-line reference. "Ends one or more tasks or processes. Processes can be killed by process ID or image name" http://technet.microsoft.com/en-us/library/bb491009.aspx

Thank you @furas for leading me to the page with the answer. I'm surprised I missed it, I tried searching for a while.

Kyle Me
  • 336
  • 2
  • 5
  • 13