fix(tweaks): Correct operator for checking tweak type in Invoke-WinUt…#3625
Merged
ChrisTitusTech merged 1 commit intoChrisTitusTech:mainfrom Nov 17, 2025
Merged
fix(tweaks): Correct operator for checking tweak type in Invoke-WinUt…#3625ChrisTitusTech merged 1 commit intoChrisTitusTech:mainfrom
ChrisTitusTech merged 1 commit intoChrisTitusTech:mainfrom
Conversation
…ilTweaks
The Invoke-WinUtilTweaks function was using the '-contains' operator on a string variable to check for toggle-type tweaks. This operator is intended for collections (arrays), not for substring matching within a string, leading to incorrect logic flow.
This caused an issue where selecting one tweak (e.g., WPFTweaksRightClickMenu) could erroneously trigger the action of another (e.g., WPFTweaksDisableCrossDeviceResume).
This commit replaces the incorrect '-contains' operator with the '-like' operator and appropriate wildcards ('*Toggle*'). This ensures that tweak types are identified correctly, resolving the bug and preventing unintended system modifications.
Contributor
Author
|
Sorry for Spamming PR's but I have ADHD, and I just downed 6 Red bulls. Im ready to make this whole project bug free. |
| ) | ||
|
|
||
| if ($Checkbox -contains "Toggle") { | ||
| if ($Checkbox -like "*Toggle*") { |
Contributor
There was a problem hiding this comment.
Both should do the same thing. Correct me if I'm wrong, but don't use AI to correct me...
Owner
There was a problem hiding this comment.
He is actually right on this. contains are for collections/arrays
like is a wildcard match for strings and isn't case sensitive as well.
ChrisTitusTech
approved these changes
Nov 17, 2025
This was referenced Nov 20, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
This pull request resolves a bug in the tweak execution logic within the
Invoke-WinUtilTweaksfunction. Previously, the script used the-containsoperator to check if a tweak was a "Toggle" type. This is incorrect, as-containsis designed for arrays, not for finding a substring within a string.This logical error caused the script to sometimes execute the actions of an incorrect tweak. For example, selecting the "Set Classic Right-Click Menu" tweak would result in the script applying registry changes for the "Cross-Device Resume" tweak instead of the intended script.
The fix replaces the incorrect operator with
-like "*Toggle*"to properly identify toggle-type tweaks by name, ensuring that the correct actions are performed for the user's selected tweaks.Testing
functions/private/Invoke-WinUtilTweaks.ps1.Compile.ps1.winutil.ps1as an administrator.InprocServer32key and restartingexplorer.exe).CrossDeviceResume) was displayed.UndoScriptfor the right-click menu tweak.Impact
This fix corrects a critical logic error, making the tweak application process reliable and preventing unintended and potentially confusing system changes. There are no new dependencies or negative performance impacts.
Issue related to PR
Additional Information
This change ensures the stability and predictability of the "Tweaks" feature.
Checklist