Skip to content

Commit f669e79

Browse files
committed
Fix ‘Use classic context menu in Windows 11’ setting
1 parent 216a247 commit f669e79

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

modifier/Optimizations.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ IEnumerable<string> SetExplorerOptions(string rootKey, string subKey)
116116
UserOnceScript.RestartExplorer();
117117
}
118118

119-
if(Configuration.HideTaskViewButton)
119+
if (Configuration.HideTaskViewButton)
120120
{
121121
appender.Append(
122122
CommandBuilder.RegistryDefaultUserCommand((rootKey, subKey) =>
@@ -355,7 +355,16 @@ IEnumerable<string> SetExplorerOptions(string rootKey, string subKey)
355355

356356
if (Configuration.ClassicContextMenu)
357357
{
358-
UserOnceScript.Append(@"New-Item -Path 'Registry::HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32' -ErrorAction 'SilentlyContinue';");
358+
UserOnceScript.Append("""
359+
$params = @{
360+
Path = 'Registry::HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32';
361+
ErrorAction = 'SilentlyContinue';
362+
Force = $true;
363+
};
364+
New-Item @params;
365+
Set-ItemProperty @params -Name '(Default)' -Value '' -Type 'String';
366+
""");
367+
UserOnceScript.RestartExplorer();
359368
}
360369

361370
if (Configuration.LeftTaskbar)

0 commit comments

Comments
 (0)