bnosac / taskscheduleR

Schedule R scripts/processes with the Windows task scheduler.
331 stars 72 forks source link

specific path lengths causes shortened command #106

Open cpenn-usgs opened 2 months ago

cpenn-usgs commented 2 months ago

When the rscript argument is 100 to 103 characters long, the command in Task Scheduler is chopped off. This can cause issues such as the ampersand being at the end of the command and prohibiting the task from running, or the log file name extension shortened to ".lo" where the "g" is left off.

jwijffels commented 2 months ago

I'm not sure if I can fix that Isn't this governed by Windows?

cpenn-usgs commented 2 months ago

When debug = TRUE the command printed to the console in R does not match the task action arguments in Task Scheduler. I'm not sure there is a fix, but adding a final check or mismatch warning could be useful. After the task is created a call to the schtasks /Query could check that the command passed to schtasks matches the returned query "Task To Run" column text.

jwijffels commented 2 months ago

Can you make a suggested pull request such that I understand how you would like to see it solved.