Why does this command not work in the Windows Task scheduler?

soffice.exe --headless --convert-to pdf --outdir=somedir somefile works from the commandline but not in windows task scheduler. Why not?

I don’t know, but an easy way is to put it in batch file, and the batch file in the task scheduler.