Windows 10 How to Start and Stop OneDrive at Specific Times?

WillyT

New Member
I want to start and stop OneDrive at SPECIFIC TIMES to use my metered Internet data during non-peak (free) periods. I read somewhere that it can be done using CMD (command line) commands but now cannot find it. Does anyone know how that is accomplished? Thank you.
 

Neemobeer

Principal Cybersecurity Architect
Staff member
You could use this batch file I wrote to toggle between onedrive running. If you wanted it to start at a specific time you can create a scheduled task with the batch file.

Code:
@ECHO OFF

SET ONEDRIVE=%LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe

REM Testing to see if Onedrive is running
TASKLIST | FINDSTR /I onedrive.exe

IF %ERRORLEVEL% == 0 GOTO RUNNING

:NOTRUNNING
START %ONEDRIVE%
ECHO Starting OneDrive...
GOTO EXIT

:RUNNING
TASKKILL /F /IM Onedrive.exe
ECHO Stopping OneDrive...

:EXIT
ECHO Operation complete...
PAUSE
 
Top