Try with admin.
Code: Select all
If !A_IsAdmin && !RegExMatch(DllCall("GetCommandLine", "str"), " /restart(?!\S)") {
Try Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
ExitApp
}
F3::Process, Close, OneDrive.exe ; Press F3 to close
In some cases, a tray icon is a ghost. If you hover over it, it disappears.
If you see OneDrive.exe in your Windows Task Manager after running this script alone, then I am not sure why it would not be working.
Here is another test.
Code: Select all
If !A_IsAdmin && !RegExMatch(DllCall("GetCommandLine", "str"), " /restart(?!\S)") {
Try Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
ExitApp
}
DetectHiddenWindows, On
Process, Close, OneDrive.exe
Sleep, 200
MsgBox, 64, OneDrive, % WinExist("ahk_exe OneDrive.exe")
ExitApp
- Output
- image006-20211206_cr-75.png (7.87 KiB) Viewed 902 times