In gpedit.msc
under Computer config -> Windows settings -> Scripts -> Shutdown I added my .bat file to execute it each time when shutting down the PC, but I would get error access denied
. It's a taskkill
command to kill certain task. It gives same error if you execute it with mouse left-click, but works if you execute it inside cmd prompt opened as administrator.
How do I execute this under administrator privileges?
Script: taskkill /f /im googledrivesync.exe
I'm working on this workaround, it's a known bug for Google Drive not quitting on system shut down.
.bat
script, use something likeSCHTASKS /RUN /TN "KillGoogledrivesync"
whereKillGoogledrivesync
is a task to runtaskkill /f /im googledrivesync.exe
in task scheduler. Should be defined to run as userSYSTEM
with the highest privileges. Enable running on demand, do not trigger on any event or time.