Restart Explorer after Applying/Undoing Classic Right-Click Advance Tweak (#1778)

In general, I've added two lines of code to get the explorer process using 'Get-Process', then passed the process object into 'Stop-Process', Windows will automatically restart explorer, so there's no need to run a new process for explorer.

Note: restarting explorer in the UndoScript might not be necessary, as it works just fine without it, that's according to the tests done by the author of this commit.
This commit is contained in:
Mr.k 2024-03-31 20:13:33 +03:00 committed by GitHub
parent 7158192744
commit 44e95b68a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2398,12 +2398,20 @@
"panel": "1", "panel": "1",
"Order": "a028_", "Order": "a028_",
"InvokeScript": [ "InvokeScript": [
"New-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Name \"InprocServer32\" -force -value \"\" " "
New-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Name \"InprocServer32\" -force -value \"\"
Write-Host Restarting explorer.exe ...
$process = Get-Process -Name \"explorer\"
Stop-Process -InputObject $process
"
], ],
"UndoScript": [ "UndoScript": [
" "
Remove-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Recurse -Confirm:$false -Force Remove-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Recurse -Confirm:$false -Force
Write-Host Restart Needed for change # Restarting Explorer in the Undo Script might not be necessary, as the Registry change without restarting Explorer does work, but just to make sure.
Write-Host Restarting explorer.exe ...
$process = Get-Process -Name \"explorer\"
Stop-Process -InputObject $process
" "
] ]
}, },