GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Support CMD-Style Environment Variable Expansion (%VARIABLE%) in PowerShell · Issue #28408 · PowerShell/PowerShell Open Labels Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group. DescriptionSummary of the new feature / enhancementAs a PowerShell user and Windows administrator, I would like PowerShell to support both its native For example, both of the following would resolve to the same environment variable value: $env:USERPROFILE %USERPROFILE% Reason for the request: Windows documentation, administrative utilities, installation instructions, and configuration interfaces frequently reference environment variables using the traditional For example, Windows Defender Firewall supports environment variables such as However, when working in PowerShell, administrators must translate these references into PowerShell's Supporting both syntaxes would:
The intent is not to replace PowerShell's existing environment variable syntax, but to provide additional compatibility and flexibility when working with Windows environment variables. Proposed technical implementation details (optional)Ideally, PowerShell would recognize and expand For example: Current PowerShell behavior: Write-Output $env:USERPROFILE Get-Item "$env:WINDIR\System32" Proposed additional syntax: Write-Output %USERPROFILE% Get-Item "%WINDIR%\System32" Both forms should produce equivalent results. This capability could also support variable expansion within strings: $Path = "%ProgramData%\MyApplication\Logs" PowerShell already provides similar functionality through .NET: [Environment]::ExpandEnvironmentVariables( '%ProgramData%\MyApplication\Logs' ) Additionally, PowerShell currently recognizes The proposed enhancement would make this functionality more accessible within normal PowerShell usage, without requiring explicit .NET method calls or the stop-parsing token. Compatibility considerations: I recognize that introducing additional variable expansion syntax could affect existing scripts that intentionally use literal percent-delimited strings. Potential approaches could include:
The specific implementation should be determined by the PowerShell team, with an emphasis on maintaining backward compatibility while improving usability. The primary objective is to allow administrators to use either environment variable notation naturally within PowerShell commands and scripts. Activity
MetadataMetadataAssigneesLabelsIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group. TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |