Can't run batch file using Windows Task Scheduler

Hi Friends, I'm running R 3.4.3 and R version Version 1.1.456 to run a batch file that runs a SQL query that spits out the output into an Excel file and emails folks. A few weeks ago it stopped running using the task scheduler. When I run the batch file manually, it works. Here is what I get on .rout:

R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Error in load(name, envir = .GlobalEnv) :
ReadItem: unknown type 52, perhaps written by later version of R
Calls: sys.load.image -> load
Execution halted

I've recreated the file and .renviron as well but with no luck. What am I doing wrong :frowning:

My best guess is that this environment has somehow become corrupted -- as far as I know, there is no R object with type (SEXPTYPE) 52. (See:

Thanks! Sorry for the novice questions here - how would you recommend I fix this? I've tried recreating the .Renviron file.

I can't think of a better prescription than just deleting the old R workspace (the .RData file).

I tried that and ended up with the same results.

Do we have any other advice on what we can do? Seems bizarre and is happening with no rhyme or reason.