Skip to content

Commit 44c28be

Browse files
committed
Added extra check for template file ext. when replacing start menu
Changed links in README.md and Get.ps1 to use latest tagged release
1 parent 88f841a commit 44c28be

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

Get.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ Write-Output "------------------------------------------------------------------
7373
Write-Output "> Downloading Win11Debloat..."
7474

7575
# Download latest version of Win11Debloat from github as zip archive
76-
Invoke-WebRequest http://github.com/raphire/win11debloat/archive/master.zip -OutFile "$env:TEMP/win11debloat-temp.zip"
76+
Invoke-WebRequest https://github.com/Raphire/Win11Debloat/zipball/master -OutFile "$env:TEMP/win11debloat-temp.zip"
7777

7878
# Remove old script folder if it exists, except for CustomAppsList and SavedSettings files
79-
if (Test-Path "$env:TEMP/Win11Debloat/Win11Debloat-master") {
79+
if (Test-Path "$env:TEMP/Win11Debloat") {
8080
Write-Output ""
8181
Write-Output "> Cleaning up old Win11Debloat folder..."
82-
Get-ChildItem -Path "$env:TEMP/Win11Debloat/Win11Debloat-master" -Exclude CustomAppsList,SavedSettings,Win11Debloat.log | Remove-Item -Recurse -Force
82+
Get-ChildItem -Path "$env:TEMP/Win11Debloat" -Exclude CustomAppsList,SavedSettings,Win11Debloat.log | Remove-Item -Recurse -Force
8383
}
8484

8585
Write-Output ""
@@ -91,6 +91,9 @@ Expand-Archive "$env:TEMP/win11debloat-temp.zip" "$env:TEMP/Win11Debloat"
9191
# Remove archive
9292
Remove-Item "$env:TEMP/win11debloat-temp.zip"
9393

94+
# Move files
95+
Get-ChildItem -Path "$env:TEMP/Win11Debloat/Raphire-Win11Debloat-*" -Recurse | Move-Item -Destination "$env:TEMP/Win11Debloat"
96+
9497
# Make list of arguments to pass on to the script
9598
$arguments = $($PSBoundParameters.GetEnumerator() | ForEach-Object {
9699
if ($_.Value -eq $true) {
@@ -105,20 +108,20 @@ Write-Output ""
105108
Write-Output "> Running Win11Debloat..."
106109

107110
# Run Win11Debloat script with the provided arguments
108-
$debloatProcess = Start-Process powershell.exe -PassThru -ArgumentList "-executionpolicy bypass -File $env:TEMP\Win11Debloat\Win11Debloat-master\Win11Debloat.ps1 $arguments" -Verb RunAs
111+
$debloatProcess = Start-Process powershell.exe -PassThru -ArgumentList "-executionpolicy bypass -File $env:TEMP\Win11Debloat\Win11Debloat.ps1 $arguments" -Verb RunAs
109112

110113
# Wait for the process to finish before continuing
111114
if ($null -ne $debloatProcess) {
112115
$debloatProcess.WaitForExit()
113116
}
114117

115118
# Remove all remaining script files, except for CustomAppsList and SavedSettings files
116-
if (Test-Path "$env:TEMP/Win11Debloat/Win11Debloat-master") {
119+
if (Test-Path "$env:TEMP/Win11Debloat") {
117120
Write-Output ""
118121
Write-Output "> Cleaning up..."
119122

120123
# Cleanup, remove Win11Debloat directory
121-
Get-ChildItem -Path "$env:TEMP/Win11Debloat/Win11Debloat-master" -Exclude CustomAppsList,SavedSettings,Win11Debloat.log | Remove-Item -Recurse -Force
124+
Get-ChildItem -Path "$env:TEMP/Win11Debloat" -Exclude CustomAppsList,SavedSettings,Win11Debloat.log | Remove-Item -Recurse -Force
122125
}
123126

124127
Write-Output ""

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
Win11Debloat is a simple, easy to use and lightweight PowerShell script that allows you to quickly declutter and improve your Windows experience. It can remove pre-installed bloatware apps, disable telemetry, remove intrusive interface elements and much more. No need to painstakingly go through all the settings yourself or remove apps one by one. Win11Debloat makes the process quick and easy!
2121

22-
The script also includes many features that system administrators will enjoy. Such as support for Windows Audit mode, the option to make changes to other Windows users and the ability to run the script without requiring user input during runtime.
22+
The script also includes many features that system administrators will enjoy. Such as support for Windows Audit mode, the option to make changes to other Windows users and the ability to run the script without requiring user input during runtime. Please refer to our [wiki](https://github.com/Raphire/Win11Debloat/wiki/) for more details.
2323

2424
![Win11Debloat Menu](/Assets/menu.png)
2525

@@ -53,7 +53,7 @@ This method supports parameters to customize the behaviour of the script. Please
5353
<details>
5454
<summary>Manually download & run the script.</summary><br/>
5555

56-
1. [Download the latest version of the script](https://github.com/Raphire/Win11Debloat/archive/master.zip), and extract the .ZIP file to your desired location.
56+
1. [Download the latest version of the script](https://github.com/Raphire/Win11Debloat/zipball/master), and extract the .ZIP file to your desired location.
5757
2. Navigate to the Win11Debloat folder
5858
3. Double click the `Run.bat` file to start the script. NOTE: If the console window immediately closes and nothing happens, try the advanced method below.
5959
4. Accept the Windows UAC prompt to run the script as administrator, this is required for the script to function.
@@ -65,7 +65,7 @@ This method supports parameters to customize the behaviour of the script. Please
6565
<details>
6666
<summary>Manually download the script & run the script via PowerShell. Recommended for advanced users.</summary><br/>
6767

68-
1. [Download the latest version of the script](https://github.com/Raphire/Win11Debloat/archive/master.zip), and extract the .ZIP file to your desired location.
68+
1. [Download the latest version of the script](https://github.com/Raphire/Win11Debloat/zipball/master), and extract the .ZIP file to your desired location.
6969
2. Open PowerShell or Terminal as an administrator.
7070
3. Temporarily enable PowerShell execution by entering the following command:
7171

@@ -139,8 +139,8 @@ Below is an overview of the key features and functionality offered by Win11Deblo
139139
- Turn off Enhance Pointer Precision, also known as mouse acceleration.
140140
- Disable Fast Start-up to ensure a full shutdown.
141141
- Disable the Sticky Keys keyboard shortcut. (W11 only)
142-
- Option to apply changes to a different user, instead of the currently logged in user.
143-
- Sysprep mode to apply changes to the Windows Default user profile. Afterwards, all new users will have the changes automatically applied to them.
142+
- Option to [apply changes to a different user](https://github.com/Raphire/Win11Debloat/wiki/Advanced-Features#running-as-another-user), instead of the currently logged in user.
143+
- [Sysprep mode](https://github.com/Raphire/Win11Debloat/wiki/Advanced-Features#sysprep-mode) to apply changes to the Windows Default user profile. Afterwards, all new users will have the changes automatically applied to them.
144144

145145
### Default Settings
146146

Win11Debloat.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,13 +645,18 @@ function ReplaceStartMenu {
645645

646646
# Check if template bin file exists, return early if it doesn't
647647
if (-not (Test-Path $startMenuTemplate)) {
648-
Write-Host "Error: Unable to replace start menu, template start2.bin file not found" -ForegroundColor Red
648+
Write-Host "Error: Unable to replace start menu, template file not found" -ForegroundColor Red
649+
return
650+
}
651+
652+
if ([IO.Path]::GetExtension($startMenuTemplate) -ne ".bin" ) {
653+
Write-Host "Error: Unable to replace start menu, template file is not a valid .bin file" -ForegroundColor Red
649654
return
650655
}
651656

652657
# Check if bin file exists, return early if it doesn't
653658
if (-not (Test-Path $startMenuBinFile)) {
654-
Write-Host "Error: Unable to replace start menu for user $(GetUserName), template start2.bin file not found" -ForegroundColor Red
659+
Write-Host "Error: Unable to replace start menu for user $(GetUserName), original start2.bin file not found" -ForegroundColor Red
655660
return
656661
}
657662

0 commit comments

Comments
 (0)