Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syncing OneDrive (SkyDrive) with Batch File (via cmd)

Basically, I'm wondering if it's possible to sync OneDrive with a batch file. See, I can sync it whenever I go to File Explorer, right click on "OneDrive" on the left, and click "Sync," but I'm wondering if there's command windows has incorporated to have this exact same effect when used with a batch file. I have no idea what it is and have searched to no avail, so I hope that you can help me! Whatever it takes, I'm sure it would be an extremely simple script; the problem is finding out what command to use. Here's an example as a picture:

enter image description here

like image 633
Laughable Junnyzup Avatar asked Oct 24 '25 18:10

Laughable Junnyzup


1 Answers

To shutdown OneDrive from the command line or in a batch file:

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

To start OneDrive from the command line:

    %LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe /background

If the /background switch is omitted then Explorer is opened to the OneDrive folder in your user profile but OneDrive does not start.

If restarting OneDrive from a batch file then add the START command or the batch file won't end:

    start %LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe /background
like image 116
NutCracker Avatar answered Oct 26 '25 09:10

NutCracker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!