CMD option to exit OneDrive

1

I am running OneDrive sync by creating scheduled tasks in Windows Task Scheduler. I have two tasks, one to start OneDrive's desktop app and the other kills it.

I am currently using taskkill to get the job done and I am not proud of it. I am looking to see if there is a graceful way to exit/close/stop OneDrive from syncing.

Does anyone know of such a thing?

Zaid Amir

Posted 2015-10-27T09:47:00.083

Reputation: 157

What wrong with task kill? – RookieTEC9 – 2015-10-28T01:35:37.863

I am looking for a more graceful way to close it – Zaid Amir – 2015-10-28T04:11:21.933

Answers

2

OneDrive.exe /shutdown is what you seek. Or more formally:

Windows Vista, 7, and 10:

cd /d %LOCALAPPDATA%\Microsoft\OneDrive
OneDrive.exe /shutdown

Windows 8.1:

cd /d %LOCALAPPDATA%\Microsoft\Windows\OneDrive
OneDrive.exe /shutdown

NOTE: To restart OneDrive from a batch file, you will need to use the "start" command. Running the .exe directly will leave the batch file open "forever".

selbie

Posted 2015-10-27T09:47:00.083

Reputation: 243