let's say i have an executable file stored in c:\my directory\my file.exe
that i would like to initiate near the beginning of my R script, and then terminate near the end of my R script. what are some clean ways do this on a windows platform?
i am aware of R commands like shell
and shell.exec
, but it's not clear to me that these will allow a clean capture of the process id to then use something like the pskill function. it's also not clear if it makes more sense to run this executable through some sort of pipe conection - or how that pipe would work. this particular executable should be included in my windows PATH
as a system variable, so it's conceivable that the system
function might be of value here as well.
additional clarification: capturing the process id might be important, because (at least for me) this will be used on a database server's executable -- if multiple database servers are currently running on the same machine, the process shouldn't kill all of them - just the one initialized at the start of the R script.
for extra credit: let's say c:\my directory\my file.exe
should be called by actually executing another file - c:\my directory\another file.bat
- but it's my file.exe
that needs to be killed at the end of the R script.