-
Notifications
You must be signed in to change notification settings - Fork 35
Improve Windows custom folder installation instructions #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
grgraf
wants to merge
1
commit into
jfilak:master
Choose a base branch
from
grgraf:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: jfilak/sapcli
Length of output: 5174
🌐 Web query:
Microsoft PowerShell about_environment_variables GetEnvironmentVariable SetEnvironmentVariable User Machine Process scope💡 Result:
In PowerShell, environment variables can be managed using the Env: drive or the.NET System.Environment class [1][2][3]. While the Env: drive is convenient for session-based changes, the System.Environment class provides the necessary control for persistent modifications across Windows scopes [1][4][5]. Session-Based Management ($env:) The $env: prefix allows you to get, set, or remove environment variables for the current PowerShell process [1][3]. Changes made this way are volatile, meaning they exist only for the duration of the current session [1][3][5]. Example: $env:MY_VAR = 'Value' Persistent Management (System.Environment) To create or modify environment variables that persist across sessions on Windows, use the System.Environment class [1][5]. These methods accept an EnvironmentVariableTarget to specify the scope [4][6]. The System.Environment.SetEnvironmentVariable and GetEnvironmentVariable methods use the following target scopes: 1. Process: Stores or retrieves the variable only in the current process (equivalent to using $env:) [6][5]. 2. User: Stores or retrieves the variable in the HKEY_CURRENT_USER\Environment registry key [6][7]. 3. Machine: Stores or retrieves the variable in the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment registry key [6][7]. This typically requires elevated (administrator) privileges [7][8]. Usage Example: [System.Environment]::SetEnvironmentVariable('MY_VAR', 'PersistentValue', 'User') Important Considerations: - Persistence and Scope: Changes to User or Machine scopes are not immediately reflected in the current process; they are typically available to new processes started after the change [6][7]. If you need the change to take effect immediately in the current session, you should update both the persistent scope and the current process scope [7][5]. - Precedence: When resolving environment variables, Windows generally follows a hierarchy: Process > User > Machine [5]. If a variable with the same name exists in multiple scopes, the Process value takes precedence [5]. - Cross-Platform Limitations: The User and Machine targets are specific to Windows [4][9]. On macOS and Linux, environment variables are generally managed within the process scope, and attempting to use User or Machine targets in.NET methods will return null or fail [4][9].
Citations:
🏁 Script executed:
Repository: jfilak/sapcli
Length of output: 1517
Keep the User PATH and current session PATH separate.
The existing user PATH may already exclude Machine PATH entries, but
$env:PATHis the current process PATH after both scopes are combined. Persisting$env:PATHcopies the existing Machine-path entries into User scope. Use the persistent User scope as the source, add the custom directory once, then also update$env:Pathor tell users to start a new shell sosapcliis available immediately.🤖 Prompt for AI Agents