From dfd44515613f38abe5a806bda36f44e7b715b50b Mon Sep 17 00:00:00 2001 From: undergroundwires Date: Tue, 24 Oct 2023 16:56:54 +0200 Subject: [PATCH] win: improve script environment robustness #221 This commit ensures the script functions as expected, even when invoked from unexpected environments. Using `setlocal` initializes a distinct environment for privacy.sexy. It's strategically placed after the admin privilege check to avoid unnecessary setup in case of a relaunch. The script concludes with `endlocal` right before the exit, maintaining a clean environment throughout its execution and ensuring no unintentional global environment modifications. Changes: - Enhance script's environment robustness. - Add descriptive comments for script start/end sequences. --- src/application/collections/windows.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/application/collections/windows.yaml b/src/application/collections/windows.yaml index 083dce7d..08b802e6 100644 --- a/src/application/collections/windows.yaml +++ b/src/application/collections/windows.yaml @@ -14,8 +14,14 @@ scripting: ) exit 0 ) + :: Initialize environment + setlocal EnableExtensions DisableDelayedExpansion endCode: |- + :: Pause the script to view the final state pause + :: Restore previous environment settings + endlocal + :: Exit the script successfully exit /b 0 actions: -