> I would like to query that if it is possible for R to terminate a program > such as > notepad, word, etc.?
pskill from the tools package says it supports the Windows system call 'TerminateProcess'. You can get a process's ID using the windows command line 'tasklist'. I got this to work on my text editor process (TextPad) using pname <- "TextPad.exe" #Amend to your process name tl <- system('tasklist', intern=TRUE) #Get the task list pid.line <- tl[grep(pname, tl)] #Find the row that matches [WARNING - I assumed only one] pid.char <- gsub(paste("^",pname," *([0-9]+).*", sep=""), "\\1", pid.line) #Extract the PID pid <- as.numeric(pid.char) #Convert to integer pskill(pid) #Kill the process You'll have to tweak that if you have more than one process with the same name, and also to check for nonexistence of an expected process. S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.