0

I'm posting this at the risk of being down voted... but I really need help on this.

I've been scouring SO and R-Bloggers trying to find out why I can't get Task Scheduler to execute my R Script. I've looked at Scheduling R Script as well as How to run R from the Task Scheduler and Batch Processing.

Caveat: I'm new to writing batch files, so this is pretty foreign territory for me.

I get one of two things happening: either the task runs successfully, but there are no outputs (assuming R was "executed", but did not run a script), or when I create a Task using the path C:\R\R-3.6.1\bin\x64\Rscript.exe and try to add parameters, I get an error stating Task Start Failed, The directory name is invalid (0x8007010B)

What's frustrating is I had this working before, but fiddled with some of my script and now it doesn't work.

Marshall
  • 85
  • 7
  • This is what I use... https://i.imgur.com/26P6Ule.jpg Note that I get weird errors if I check the "Run whether user is logged on or not" checkbox on the "general" tab. It only works for me with "Run only when user is logged on" – cory Feb 13 '20 at 16:59
  • Unfortunately, this still isn’t working. It looks line Task Schedule is just “spinning” – Marshall Feb 13 '20 at 17:24
  • 1
    You gave your argument as just a filename, `run.R`, without a path. I would also assume that you were expecting the current directory of the command to be the same as the location of that file. My guess is that your file is not in `C:\Windows\System32`. The fix is probably therefore to use the full absolute path to `run.R` – Compo Feb 13 '20 at 17:37
  • I've done both. I have R in my ```C:\``` and the file I'm trying to execute is in my ```R:\```. My file path is ```R:\R_Reports\scripts\controlled_medication\my_script.R``` – Marshall Feb 13 '20 at 17:40
  • Is `R:` a network drive? If so, perhaps it isn't mapped to `R:` at the time it is needed. Possibly, the mapping is not accessible to the user under whom the task is assigned. – Compo Feb 13 '20 at 17:50
  • It is a network drive. Should I move the files to ```C:\```? – Marshall Feb 13 '20 at 17:51
  • Read [ask] and [mcve]. Export your task to xml and post that here. Post your script, or at least explain exactly what "fiddled with some of my script" means. – jwdonahue Feb 13 '20 at 18:20
  • have you tried the "Start in" option for your action. That should be the directory of your R script. OR, you can specify a full path for your R script (run.R in my example above) – cory Feb 13 '20 at 18:24

0 Answers0