# can't start r process in cmd

process=StartProcess[$SystemShell]; outputFile=FileNameJoin[{NotebookDirectory[],"output.txt"}]; ClearAll[run]; run[commands_,seconds_:2]:=Module[{}, commandSent=commands<>" > \""<>outputFile<>"\""; WriteLine[process,commandSent]; Pause[seconds]; Import[outputFile] ];$rDirectory="C:\\Program Files\\R\\R-3.3.0\\bin\\x64";


now runnning

run["cd \""<>\$rDirectory<>"\""]


and

run["dir"]


produces the same result as running on cmd directly but running

run["R.exe"]


doesn't seem to start the R process. But if i do these directly on cmd it works.

I have used this method several times to connect to external processes but it is not working for R. Someone please help!!!

• Run is for single execution while i want to keep sending a sequence of commands programmatically and retrieve results. Can you please check whether i am the only one having this problem or there is some issue? Sep 15 '18 at 17:49
• Oh sorry. Forget about what I said. I thought it was about a typo... Sep 15 '18 at 17:51
• But you might be interested in RLink... Sep 15 '18 at 17:53
• Stupid RLink crashes for large data. And has other bugs. I want the program to run in R but queries generated programmatically since there are alot of combinations. Sep 15 '18 at 17:55
• Do i need to add it to "PATH" since i am cd-ing to the directory which has the executable? Sep 15 '18 at 17:56