Forum Discussion

domtrump's avatar
domtrump
Copper Contributor
Dec 11, 2023

Suspend one drive while program runs

I was told by another user in a different windows forum that I should post this question here:

 

I have a situation where I need to pause OneDrive before I start an application and then resume it after I close the application. I have been doing this manually, but need to automate it with some kind of script.

Google searches have yielded a couple of solutions but I'm not quite sure how to use them. I assume both of these would use a simple batch file.

#1:

[Suspend (shutdown) Onedrive:]

"%LOCALAPPDATA%\Microsoft\OneDrive\onedrive" /shutdown

[Resume Onedrive:]

start "OneDrive" /B "%LOCALAPPDATA%\Microsoft\OneDrive\onedrive" /background

In this scenario, where/how would I start the <application> and how would I tell the script to wait until I exit <application> before performing the "resume" portion?

#2:

This suggestion uses psuspend from sysinternals

pssuspend onedrive
<application>
pssuspend -r onedrive

I assume that psuspend would have to be placed in the folder where the OneDrive .exe resides? What would be the full command to launch <application>?

Would either of these accomplish what I'm looking for or is there a better approach?

No RepliesBe the first to reply

Resources