Skip to content

Portable Tool for an Ideal Windows Setup

fix safe mode exit issue (#114) & win10 defender disabling

Greedeks95f4db405da7
diff --git a/.Source/GTweak/Resources/DisablingWD.gz b/.Source/GTweak/Resources/DisablingWD.gz
index 0fd65a61..eb7f5697 100644
Binary files a/.Source/GTweak/Resources/DisablingWD.gz and b/.Source/GTweak/Resources/DisablingWD.gz differ
diff --git a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs b/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
index 9cdc8537..07f3ecd3 100644
--- a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
+++ b/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
@@ -47,7 +47,9 @@ namespace GTweak.Utilities.Helpers
}
internal static void RunCommandAsTrustedInstaller(string command, bool isPowerShell = false) =>
- TrustedInstaller.CreateProcessAsTrustedInstaller(PID, isPowerShell ? $"{PathLocator.Executable.PowerShell} -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{command.Replace("\"", "`\"")}\"" : $"{PathLocator.Executable.CommandShell} {command}");
+ TrustedInstaller.CreateProcessAsTrustedInstaller(PID, isPowerShell
+ ? $"\"{PathLocator.Executable.PowerShell}\" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{command.Replace("\"", "`\"")}\""
+ : $"\"{PathLocator.Executable.CommandShell}\" {command}");
internal static async void RunCommand(string command, bool isPowerShell = false)
{
diff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
index 0be2fa21..e375408f 100644
--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
@@ -218,7 +218,7 @@ namespace GTweak.Utilities.Tweaks
if (isDisabled)
{
- CommandExecutor.RunCommandAsTrustedInstaller($@"cmd /c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
$@"takeown /f ""{currentFilePath}"" /a",
$@"icacls ""{currentFilePath}"" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18",
$@"icacls ""{currentFilePath}"" /grant ""{Environment.UserName}"":F",
@@ -226,7 +226,7 @@ namespace GTweak.Utilities.Tweaks
}
else
{
- CommandExecutor.RunCommandAsTrustedInstaller($@"cmd /c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
$@"takeown /f ""{currentFilePath}"" /a",
$@"rename ""{currentFilePath}"" ""{Path.GetFileName(targetFilePath)}""",
$@"icacls ""{targetFilePath}"" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464",