Title: Automatic variable provider · Issue #27023 · PowerShell/PowerShell · GitHub
Open Graph Title: Automatic variable provider · Issue #27023 · PowerShell/PowerShell
X Title: Automatic variable provider · Issue #27023 · PowerShell/PowerShell
Description: Summary of the new feature / enhancement Reading the (recent) requests for additional automatic variables, I often see the general argument: Adding an automatic variable might break existing scripts Which is a valid argument but shouldn'...
Open Graph Description: Summary of the new feature / enhancement Reading the (recent) requests for additional automatic variables, I often see the general argument: Adding an automatic variable might break existing script...
X Description: Summary of the new feature / enhancement Reading the (recent) requests for additional automatic variables, I often see the general argument: Adding an automatic variable might break existing script...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/27023
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Automatic variable provider","articleBody":"### Summary of the new feature / enhancement\n\nReading the (recent) [requests for additional automatic variables](https://github.com/PowerShell/PowerShell/issues?q=automatic%20variable%20in%3Atitle), I often see the general argument:\n\n> _Adding an automatic variable might break existing scripts_\n\nWhich _is_ a valid argument but **shouldn't be a valid argument**. With nearly **50** automatic variables, this is going to look like a rookie mistake similar to [using the `\u003cverb>-Variable` cmdlets for dynamic variable names](https://stackoverflow.com/a/68830451/1701026).\n\nMost requests for new automatic variables are based on easy access or a clearer syntax. For the latter, I personally prefer the automatic variables as they do not require any parentheses (e.g. in the case of a cmdlet) or square brackets (e.g. in case of a hash table) when included in an expression.\n\n### Proposed technical implementation details (optional)\n\nAfaik, a PSDrive reference of a **provider** might be used interchangeably with **variable** names:\n\n```PowerShell\n$Env = 'foo'\n$Env:temp\n# C:\\Users\\user\\AppData\\Local\\Temp\n$Env\n# foo\n```\n\nWhich to my opinion means that if the automatic variables are contained by a separate PowerShell provider they shouldn't cause any break changes and even the provider name itself could afaik be something like `$PS:` or possibly just `$:` (probably as a syntactic sugar) as e.g.: `$PS:Input` or `$:Input` rather than: `$Input`.\n\nFollowing the stackoverflow questions and answers closely, I can tell, almost every PowerShell starter falls into the automatic `$Input` variable pitfall.\nAlthough an automatic variable provider won't fix that for the installed base, it will better allow for additional automatic variables (like [`$:now`](https://github.com/PowerShell/PowerShell/issues/24079)).\nAnd in the future, I think it might be possible to remove about 90% of the current (potential conflicting) automatic variable names with an optional environment preference.","author":{"url":"https://github.com/iRon7","@type":"Person","name":"iRon7"},"datePublished":"2026-03-13T12:49:53Z","url":"https://github.com/PowerShell/PowerShell/issues/27023"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ad9ba99c-4548-ad1e-aed8-27adacb4947d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C824:8865B:29BB49:3757FC:6AFD16C3 |
| html-safe-nonce | 7a9a9e41d4fedf6aad6939c7218544c57ecdbf2ea8f61a9cde507d4a1cd384dc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODI0Ojg4NjVCOjI5QkI0OTozNzU3RkM6NkFGRDE2QzMiLCJ2aXNpdG9yX2lkIjoiMzI4NjM4MTQxNjE2NTQ4MDEzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e425587769ea222e1a083942c0aa6d53ad50bebdd57a31d2eb6007e79bd81b93 |
| hovercard-subject-tag | issue:4070934549 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/27023/issue_layout |
| twitter:image | https://opengraph.githubassets.com/24532e2968726756c310e9c49be88cd7db1569a8f5b76c446dd9513253fb3a53/PowerShell/PowerShell/issues/27023 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/24532e2968726756c310e9c49be88cd7db1569a8f5b76c446dd9513253fb3a53/PowerShell/PowerShell/issues/27023 |
| og:image:alt | Summary of the new feature / enhancement Reading the (recent) requests for additional automatic variables, I often see the general argument: Adding an automatic variable might break existing script... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iRon7 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 065128366c233a9d57ff68ab6c96e25b99dd1b0ab70d23b70873d3dd6b5e4f19 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 941021edf0c2ec58298f4a2c8f27ae507d129c92 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width