My problem was caused by OneDrive. OneDrive was syncing the folder my batch file lived in, and that seems to prevent Task Scheduler from executing it. (Doesn't anyone at MS test this kind of thing?)
Anyway by moving my batch file to a folder that wasn't in OneDrive the batch file could be started by Task Scheduler.