Skip to content

Commit

Permalink
Context menu options are now also shown for W11 users
Browse files Browse the repository at this point in the history
if they have selected the "restore old W10 style context menu" option.

Other minor changes:
- Added a short delay before restarting the explorer process
- LastSettings will now show an error and not attempt to remove apps if the script cannot find the CustomAppsList file
  • Loading branch information
Raphire committed Mar 6, 2024
1 parent a054653 commit bd6de86
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Menus/Info
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ through all the settings yourself, or removing apps one by one!
Using the custom mode you can
-------------------------------------------------------------------------------------------
- Remove bloatware apps, with the option to select exactly what apps to remove or keep.
- Remove all pinned apps from the start menu. NOTE: This applies to all existing and new users. (Windows 11 build 22621+)
- Remove all pinned apps from the start menu. This applies to all existing and new users. (Windows 11 build 22621+)
- Disable telemetry, diagnostic data, app-launch tracking & targeted ads.
- Disable & remove bing search & cortana in Windows search.
- Disable tips, tricks, suggestions and ads in start, settings, notifications, windows explorer, and on the lockscreen.
- Disable Windows Copilot. (Windows 11 build 22621+)
- Restore the old Windows 10 style context menu. (Windows 11 build 22000+)
- Show hidden files, folders and drives.
- Show file extensions for known file types.
- Hide duplicate removable drive entries from the windows explorer navigation pane, so only the entry under 'This PC' remains.
- Hide duplicate removable drive entries from the windows explorer sidepane, so only the entry under 'This PC' remains.
- Align taskbar icons to the left. (Windows 11 build 22000+)
- Hide or change the search icon/box on the taskbar. (Windows 11 build 22000+)
- Hide the taskview button from the taskbar. (Windows 11 build 22000+)
Expand Down
40 changes: 25 additions & 15 deletions Win11Debloat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,12 @@ function RegImport {
function RestartExplorer {
Write-Output "> Restarting Windows explorer to apply all changes. Note: This may cause some flickering."

Start-Sleep 0.5
Start-Sleep 0.3

taskkill /f /im explorer.exe

Start-Sleep 0.3

Start-Process explorer.exe

Write-Output ""
Expand Down Expand Up @@ -445,7 +447,7 @@ if ((-not $global:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or ($SPP

# Only show this option if LastSettings file exists
if (Test-Path "$PSScriptRoot/LastSettings") {
Write-Output "(3) New: Run the script with the settings from last time"
Write-Output "(3) Run the script with the settings from last time"
$ModeSelectionMessage = "Please select an option (1/2/3/0)"
}

Expand Down Expand Up @@ -487,19 +489,27 @@ if ((-not $global:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or ($SPP
Write-Output $line.Substring(($line.IndexOf('#') + 1), ($line.Length - $line.IndexOf('#') - 1))
$paramName = $line.Substring(0, $line.IndexOf('#'))

# Print list of apps slated for removal if paramName is RemoveAppsCustom and CustomAppsList exists
if(($paramName -eq "RemoveAppsCustom") -and (Test-Path "$PSScriptRoot/CustomAppsList")) {
$appsList = @()

# Get apps list from file
Foreach ($app in (Get-Content -Path "$PSScriptRoot/CustomAppsList" )) {
# Remove any spaces before and after the app name
$app = $app.Trim()
if($paramName -eq "RemoveAppsCustom") {
# If paramName is RemoveAppsCustom, check if CustomAppsFile exists
if(Test-Path "$PSScriptRoot/CustomAppsList") {
# Apps file exists, print list of apps
$appsList = @()

$appsList += $app
# Get apps list from file
Foreach ($app in (Get-Content -Path "$PSScriptRoot/CustomAppsList" )) {
# Remove any spaces before and after the app name
$app = $app.Trim()

$appsList += $app
}

Write-Host $appsList -ForegroundColor DarkGray
}
else {
# Apps file does not exist, print error and continue to next item
Write-Host "Could not load apps from file, no apps will be removed" -ForegroundColor Red
continue
}

Write-Host $appsList -ForegroundColor Gray
}

if(-not $global:Params.ContainsKey($ParameterName)){
Expand Down Expand Up @@ -750,8 +760,8 @@ if ((-not $global:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or ($SPP
}
}

# Only show option for disabling context menu items for Windows 10 users
if (get-ciminstance -query "select caption from win32_operatingsystem where caption like '%Windows 10%'"){
# Only show option for disabling context menu items for Windows 10 users or if the user opted to restore the Windows 10 context menu
if ((get-ciminstance -query "select caption from win32_operatingsystem where caption like '%Windows 10%'") -or $global:Params.ContainsKey('RevertContextMenu')){
Write-Output ""

if ($( Read-Host -Prompt "Do you want to disable any context menu options? (y/n)" ) -eq 'y') {
Expand Down

0 comments on commit bd6de86

Please sign in to comment.