How to download a file directly from OneDrive

At times you want to just download a file from OneDrive without using the browser.

The share link provided my OneDrive does not allow you to just download a file as it forces the viewer to open the web browser and then download the file. At times you just want to download the file via command line and the created shared link will not work.

Add &download=1 to the end of the OneDrive shared link.
Here is an example:


With this link you can then use the following PowerShell command to download a file:
Invoke-WebRequest -Uri “https://OneDriveLongURLRemovedForSecurity/ET1R5tRTR55567DdBtg5K6sB6ooX-7KNG5OUOspsOIEv8Q?e=bUTwh7&download=1” -OutFile “C:\path\filename.ext”

How did you like this article?0036