What type of object is $: (such as `$code:`) in Powershell?Setting Windows PowerShell path variableDetermine installed PowerShell versionTerminating a script in PowerShellHow to run a PowerShell scriptWhat does $_ mean in PowerShell?PowerShell says “execution of scripts is disabled on this system.”How do you comment out code in PowerShell?Powershell variable expansion when calling other programsPowershell Continuations (>>) Broken In ISE But Not Normal Promptget-vm not working in a switch parameter
"Marked down as someone wanting to sell shares." What does that mean?
Are hand made posters acceptable in Academia?
Did I make a mistake by ccing email to boss to others?
A seasonal riddle
What (if any) is the reason to buy in small local stores?
Rendered textures different to 3D View
Can a Knock spell open the door to Mordenkainen's Magnificent Mansion?
Reasons for having MCU pin-states default to pull-up/down out of reset
Has the laser at Magurele, Romania reached a tenth of the Sun's power?
categorizing a variable turns it from insignificant to significant
Why would five hundred and five same as one?
Should I warn a new PhD Student?
Why is participating in the European Parliamentary elections used as a threat?
Magnifying glass in hyperbolic space
Unfrosted light bulb
Weird lines in Microsoft Word
Is there a POSIX way to shutdown a UNIX machine?
Is there a distance limit for minecart tracks?
Why does the frost depth increase when the surface temperature warms up?
Can you describe someone as luxurious? As in someone who likes luxurious things?
"Oh no!" in Latin
Sort with assumptions
Do native speakers use "ultima" and "proxima" frequently in spoken English?
Relations between homogeneous polynomials
What type of object is $: (such as `$code:`) in Powershell?
Setting Windows PowerShell path variableDetermine installed PowerShell versionTerminating a script in PowerShellHow to run a PowerShell scriptWhat does $_ mean in PowerShell?PowerShell says “execution of scripts is disabled on this system.”How do you comment out code in PowerShell?Powershell variable expansion when calling other programsPowershell Continuations (>>) Broken In ISE But Not Normal Promptget-vm not working in a switch parameter
I was using tab autocompletion for a variable name in Powershell 5.1 today and noticed that one of the choices was the name of a PSDrive. The drive name is docs
and I wanted to expand is called $document_name
. when I typed $do<tab>
, the shell did indeed expand what I had typed to $document_name
but for some reason, I typed <tab>
a second time and the expanded text changed to docs:
.
I explored further and found that this type of variable exists for each of my PSDrives, or at least tab expansion suggests that it does.
More formally, for every PSDrive PSD, tab expansion believes that $PSD:
is a valid thing.
My question is simple: what the heck are these? Here are some things I've observed so far:
- These names are prefixed with
$
, so they look like PS variables. For the rest of this discussion (and in the earlier discussion above), I will assume they are variables and refer to them as such. - Although they appear to be variables, they are not listed in the
Variable:
PSDrive like most variables. In this way, it behaves like the$env
"variable," which also is not listed inVariable:
. I have a feeling if I could find documentation about$env
, then I'd understand these objects also. - In some ways, they behave like pointers to filesystem objects. For example, if there is a file name
readme.txt
containing the text "Hello, world!" on a PSDrive namedcode
, then all of the following are possible interactions with Powershell.
Fetch the contents of the file.
λ $code:readme.txt
Hello, world!
Just to prove that the type of the above result is String
:
λ $code:readme.txt | % $_.GetType().Name
String
Trying to use this as a reference to the PSDrive doesn't work well for many operations, such as cd
:
C:
λ cd $code:
At line:1 char:4
+ cd $code:
+ ~~~~~~~~
Variable reference is not valid. The variable name is missing.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidBracedVariableReference
I could go on, but I'm stumped. If I pass $code:
(or $env:
, for that matter) to Get-Member
, I get an error saying Variable reference is not valid
.
So just what the heck are "variables" like $env
and $<PSDrive>:
(such as $code:
)? Are they expressions? Built-in expressions? Some kind of object? Thanks for any help.
powershell powershell-v5.1 new-psdrive
add a comment |
I was using tab autocompletion for a variable name in Powershell 5.1 today and noticed that one of the choices was the name of a PSDrive. The drive name is docs
and I wanted to expand is called $document_name
. when I typed $do<tab>
, the shell did indeed expand what I had typed to $document_name
but for some reason, I typed <tab>
a second time and the expanded text changed to docs:
.
I explored further and found that this type of variable exists for each of my PSDrives, or at least tab expansion suggests that it does.
More formally, for every PSDrive PSD, tab expansion believes that $PSD:
is a valid thing.
My question is simple: what the heck are these? Here are some things I've observed so far:
- These names are prefixed with
$
, so they look like PS variables. For the rest of this discussion (and in the earlier discussion above), I will assume they are variables and refer to them as such. - Although they appear to be variables, they are not listed in the
Variable:
PSDrive like most variables. In this way, it behaves like the$env
"variable," which also is not listed inVariable:
. I have a feeling if I could find documentation about$env
, then I'd understand these objects also. - In some ways, they behave like pointers to filesystem objects. For example, if there is a file name
readme.txt
containing the text "Hello, world!" on a PSDrive namedcode
, then all of the following are possible interactions with Powershell.
Fetch the contents of the file.
λ $code:readme.txt
Hello, world!
Just to prove that the type of the above result is String
:
λ $code:readme.txt | % $_.GetType().Name
String
Trying to use this as a reference to the PSDrive doesn't work well for many operations, such as cd
:
C:
λ cd $code:
At line:1 char:4
+ cd $code:
+ ~~~~~~~~
Variable reference is not valid. The variable name is missing.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidBracedVariableReference
I could go on, but I'm stumped. If I pass $code:
(or $env:
, for that matter) to Get-Member
, I get an error saying Variable reference is not valid
.
So just what the heck are "variables" like $env
and $<PSDrive>:
(such as $code:
)? Are they expressions? Built-in expressions? Some kind of object? Thanks for any help.
powershell powershell-v5.1 new-psdrive
add a comment |
I was using tab autocompletion for a variable name in Powershell 5.1 today and noticed that one of the choices was the name of a PSDrive. The drive name is docs
and I wanted to expand is called $document_name
. when I typed $do<tab>
, the shell did indeed expand what I had typed to $document_name
but for some reason, I typed <tab>
a second time and the expanded text changed to docs:
.
I explored further and found that this type of variable exists for each of my PSDrives, or at least tab expansion suggests that it does.
More formally, for every PSDrive PSD, tab expansion believes that $PSD:
is a valid thing.
My question is simple: what the heck are these? Here are some things I've observed so far:
- These names are prefixed with
$
, so they look like PS variables. For the rest of this discussion (and in the earlier discussion above), I will assume they are variables and refer to them as such. - Although they appear to be variables, they are not listed in the
Variable:
PSDrive like most variables. In this way, it behaves like the$env
"variable," which also is not listed inVariable:
. I have a feeling if I could find documentation about$env
, then I'd understand these objects also. - In some ways, they behave like pointers to filesystem objects. For example, if there is a file name
readme.txt
containing the text "Hello, world!" on a PSDrive namedcode
, then all of the following are possible interactions with Powershell.
Fetch the contents of the file.
λ $code:readme.txt
Hello, world!
Just to prove that the type of the above result is String
:
λ $code:readme.txt | % $_.GetType().Name
String
Trying to use this as a reference to the PSDrive doesn't work well for many operations, such as cd
:
C:
λ cd $code:
At line:1 char:4
+ cd $code:
+ ~~~~~~~~
Variable reference is not valid. The variable name is missing.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidBracedVariableReference
I could go on, but I'm stumped. If I pass $code:
(or $env:
, for that matter) to Get-Member
, I get an error saying Variable reference is not valid
.
So just what the heck are "variables" like $env
and $<PSDrive>:
(such as $code:
)? Are they expressions? Built-in expressions? Some kind of object? Thanks for any help.
powershell powershell-v5.1 new-psdrive
I was using tab autocompletion for a variable name in Powershell 5.1 today and noticed that one of the choices was the name of a PSDrive. The drive name is docs
and I wanted to expand is called $document_name
. when I typed $do<tab>
, the shell did indeed expand what I had typed to $document_name
but for some reason, I typed <tab>
a second time and the expanded text changed to docs:
.
I explored further and found that this type of variable exists for each of my PSDrives, or at least tab expansion suggests that it does.
More formally, for every PSDrive PSD, tab expansion believes that $PSD:
is a valid thing.
My question is simple: what the heck are these? Here are some things I've observed so far:
- These names are prefixed with
$
, so they look like PS variables. For the rest of this discussion (and in the earlier discussion above), I will assume they are variables and refer to them as such. - Although they appear to be variables, they are not listed in the
Variable:
PSDrive like most variables. In this way, it behaves like the$env
"variable," which also is not listed inVariable:
. I have a feeling if I could find documentation about$env
, then I'd understand these objects also. - In some ways, they behave like pointers to filesystem objects. For example, if there is a file name
readme.txt
containing the text "Hello, world!" on a PSDrive namedcode
, then all of the following are possible interactions with Powershell.
Fetch the contents of the file.
λ $code:readme.txt
Hello, world!
Just to prove that the type of the above result is String
:
λ $code:readme.txt | % $_.GetType().Name
String
Trying to use this as a reference to the PSDrive doesn't work well for many operations, such as cd
:
C:
λ cd $code:
At line:1 char:4
+ cd $code:
+ ~~~~~~~~
Variable reference is not valid. The variable name is missing.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidBracedVariableReference
I could go on, but I'm stumped. If I pass $code:
(or $env:
, for that matter) to Get-Member
, I get an error saying Variable reference is not valid
.
So just what the heck are "variables" like $env
and $<PSDrive>:
(such as $code:
)? Are they expressions? Built-in expressions? Some kind of object? Thanks for any help.
powershell powershell-v5.1 new-psdrive
powershell powershell-v5.1 new-psdrive
edited Mar 7 at 19:25
chris.leonard
asked Mar 7 at 1:00
chris.leonardchris.leonard
412410
412410
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
What you're seeing is namespace variable notation, which is a variable-based way to access the content of items in PowerShell drives whose underlying provider implements content-based access (i.e., implements the IContentCmdletProvider
interface).
The general syntax is:
$<drive>:<path> # same as: Get-Content <drive>:<path>
$<drive>:<path> = ... # same as: Set-Content <drive>:<path> -Value ...
The enclosing ...
aren't necessary if both the <drive>
name and the <path>
can syntactically serve as a variable name; e.g.:
$env:HOME # no ... needed
$env:ProgramFiles(x86) # ... needed due to "(" and ")"
In practice, as of Windows PowerShell v5.1, the following in-box drive providers support namespace variable notation:
- Environment (drive
Env:
) - Function (drive
Function:
) - Alias (drive
Alias:
) - FileSystem (drives
C:
, ...) - Variable (drive
Variable:
) - though virtually pointless, given that omitting the drive part accesses variables by default (e.g.,$variable:HOME
is the same as just$HOME
).
Of these, the Env:
drive is by far the most frequently used with namespace variable notation, even though most users aren't aware of what underlies an environment-variable references such as $env:HOME
.
On occasion you see it used with a filesystem drive - e.g., $c:foofile.txt
- but the fact that you can only use literal paths and that you cannot control the character encoding limits its usefulness.
It allows interesting uses, however; e.g.:
PS> $alias:foreach # Get the definition of alias 'foreach'
ForEach-Object
PS> $function:prompt # Get the body of the 'prompt' function
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
# .Link
# https://go.microsoft.com/fwlink/?LinkID=225750
# .ExternalHelp System.Management.Automation.dll-help.xml
# Define a function foo that echoes 'hi' and invoke it.
PS> $function:foo = 'hi' ; foo
hi
Note: As of this writing, namespace variable notation isn't officially documented yet, but this GitHub issue suggests doing so.
add a comment |
$env
is the Windows environment variables, the same as what you get when you do SET
in a command prompt. There are a few that are PS-specific.
The variable is providing access to the Environment Provider. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-6
There are a bunch of other Providers that are described here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_providers?view=powershell-6
As it says in the doco:
The model for data presentation is a file system drive. To use data
that the provider exposes, you view it, move through it, and change it
as though it were data on a hard drive. Therefore, the most important
information about a provider is the name of the drive that it
supports.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55034497%2fwhat-type-of-object-is-drivename-such-as-code-in-powershell%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
What you're seeing is namespace variable notation, which is a variable-based way to access the content of items in PowerShell drives whose underlying provider implements content-based access (i.e., implements the IContentCmdletProvider
interface).
The general syntax is:
$<drive>:<path> # same as: Get-Content <drive>:<path>
$<drive>:<path> = ... # same as: Set-Content <drive>:<path> -Value ...
The enclosing ...
aren't necessary if both the <drive>
name and the <path>
can syntactically serve as a variable name; e.g.:
$env:HOME # no ... needed
$env:ProgramFiles(x86) # ... needed due to "(" and ")"
In practice, as of Windows PowerShell v5.1, the following in-box drive providers support namespace variable notation:
- Environment (drive
Env:
) - Function (drive
Function:
) - Alias (drive
Alias:
) - FileSystem (drives
C:
, ...) - Variable (drive
Variable:
) - though virtually pointless, given that omitting the drive part accesses variables by default (e.g.,$variable:HOME
is the same as just$HOME
).
Of these, the Env:
drive is by far the most frequently used with namespace variable notation, even though most users aren't aware of what underlies an environment-variable references such as $env:HOME
.
On occasion you see it used with a filesystem drive - e.g., $c:foofile.txt
- but the fact that you can only use literal paths and that you cannot control the character encoding limits its usefulness.
It allows interesting uses, however; e.g.:
PS> $alias:foreach # Get the definition of alias 'foreach'
ForEach-Object
PS> $function:prompt # Get the body of the 'prompt' function
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
# .Link
# https://go.microsoft.com/fwlink/?LinkID=225750
# .ExternalHelp System.Management.Automation.dll-help.xml
# Define a function foo that echoes 'hi' and invoke it.
PS> $function:foo = 'hi' ; foo
hi
Note: As of this writing, namespace variable notation isn't officially documented yet, but this GitHub issue suggests doing so.
add a comment |
What you're seeing is namespace variable notation, which is a variable-based way to access the content of items in PowerShell drives whose underlying provider implements content-based access (i.e., implements the IContentCmdletProvider
interface).
The general syntax is:
$<drive>:<path> # same as: Get-Content <drive>:<path>
$<drive>:<path> = ... # same as: Set-Content <drive>:<path> -Value ...
The enclosing ...
aren't necessary if both the <drive>
name and the <path>
can syntactically serve as a variable name; e.g.:
$env:HOME # no ... needed
$env:ProgramFiles(x86) # ... needed due to "(" and ")"
In practice, as of Windows PowerShell v5.1, the following in-box drive providers support namespace variable notation:
- Environment (drive
Env:
) - Function (drive
Function:
) - Alias (drive
Alias:
) - FileSystem (drives
C:
, ...) - Variable (drive
Variable:
) - though virtually pointless, given that omitting the drive part accesses variables by default (e.g.,$variable:HOME
is the same as just$HOME
).
Of these, the Env:
drive is by far the most frequently used with namespace variable notation, even though most users aren't aware of what underlies an environment-variable references such as $env:HOME
.
On occasion you see it used with a filesystem drive - e.g., $c:foofile.txt
- but the fact that you can only use literal paths and that you cannot control the character encoding limits its usefulness.
It allows interesting uses, however; e.g.:
PS> $alias:foreach # Get the definition of alias 'foreach'
ForEach-Object
PS> $function:prompt # Get the body of the 'prompt' function
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
# .Link
# https://go.microsoft.com/fwlink/?LinkID=225750
# .ExternalHelp System.Management.Automation.dll-help.xml
# Define a function foo that echoes 'hi' and invoke it.
PS> $function:foo = 'hi' ; foo
hi
Note: As of this writing, namespace variable notation isn't officially documented yet, but this GitHub issue suggests doing so.
add a comment |
What you're seeing is namespace variable notation, which is a variable-based way to access the content of items in PowerShell drives whose underlying provider implements content-based access (i.e., implements the IContentCmdletProvider
interface).
The general syntax is:
$<drive>:<path> # same as: Get-Content <drive>:<path>
$<drive>:<path> = ... # same as: Set-Content <drive>:<path> -Value ...
The enclosing ...
aren't necessary if both the <drive>
name and the <path>
can syntactically serve as a variable name; e.g.:
$env:HOME # no ... needed
$env:ProgramFiles(x86) # ... needed due to "(" and ")"
In practice, as of Windows PowerShell v5.1, the following in-box drive providers support namespace variable notation:
- Environment (drive
Env:
) - Function (drive
Function:
) - Alias (drive
Alias:
) - FileSystem (drives
C:
, ...) - Variable (drive
Variable:
) - though virtually pointless, given that omitting the drive part accesses variables by default (e.g.,$variable:HOME
is the same as just$HOME
).
Of these, the Env:
drive is by far the most frequently used with namespace variable notation, even though most users aren't aware of what underlies an environment-variable references such as $env:HOME
.
On occasion you see it used with a filesystem drive - e.g., $c:foofile.txt
- but the fact that you can only use literal paths and that you cannot control the character encoding limits its usefulness.
It allows interesting uses, however; e.g.:
PS> $alias:foreach # Get the definition of alias 'foreach'
ForEach-Object
PS> $function:prompt # Get the body of the 'prompt' function
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
# .Link
# https://go.microsoft.com/fwlink/?LinkID=225750
# .ExternalHelp System.Management.Automation.dll-help.xml
# Define a function foo that echoes 'hi' and invoke it.
PS> $function:foo = 'hi' ; foo
hi
Note: As of this writing, namespace variable notation isn't officially documented yet, but this GitHub issue suggests doing so.
What you're seeing is namespace variable notation, which is a variable-based way to access the content of items in PowerShell drives whose underlying provider implements content-based access (i.e., implements the IContentCmdletProvider
interface).
The general syntax is:
$<drive>:<path> # same as: Get-Content <drive>:<path>
$<drive>:<path> = ... # same as: Set-Content <drive>:<path> -Value ...
The enclosing ...
aren't necessary if both the <drive>
name and the <path>
can syntactically serve as a variable name; e.g.:
$env:HOME # no ... needed
$env:ProgramFiles(x86) # ... needed due to "(" and ")"
In practice, as of Windows PowerShell v5.1, the following in-box drive providers support namespace variable notation:
- Environment (drive
Env:
) - Function (drive
Function:
) - Alias (drive
Alias:
) - FileSystem (drives
C:
, ...) - Variable (drive
Variable:
) - though virtually pointless, given that omitting the drive part accesses variables by default (e.g.,$variable:HOME
is the same as just$HOME
).
Of these, the Env:
drive is by far the most frequently used with namespace variable notation, even though most users aren't aware of what underlies an environment-variable references such as $env:HOME
.
On occasion you see it used with a filesystem drive - e.g., $c:foofile.txt
- but the fact that you can only use literal paths and that you cannot control the character encoding limits its usefulness.
It allows interesting uses, however; e.g.:
PS> $alias:foreach # Get the definition of alias 'foreach'
ForEach-Object
PS> $function:prompt # Get the body of the 'prompt' function
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
# .Link
# https://go.microsoft.com/fwlink/?LinkID=225750
# .ExternalHelp System.Management.Automation.dll-help.xml
# Define a function foo that echoes 'hi' and invoke it.
PS> $function:foo = 'hi' ; foo
hi
Note: As of this writing, namespace variable notation isn't officially documented yet, but this GitHub issue suggests doing so.
edited Mar 7 at 19:44
answered Mar 7 at 5:13
mklement0mklement0
136k22253290
136k22253290
add a comment |
add a comment |
$env
is the Windows environment variables, the same as what you get when you do SET
in a command prompt. There are a few that are PS-specific.
The variable is providing access to the Environment Provider. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-6
There are a bunch of other Providers that are described here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_providers?view=powershell-6
As it says in the doco:
The model for data presentation is a file system drive. To use data
that the provider exposes, you view it, move through it, and change it
as though it were data on a hard drive. Therefore, the most important
information about a provider is the name of the drive that it
supports.
add a comment |
$env
is the Windows environment variables, the same as what you get when you do SET
in a command prompt. There are a few that are PS-specific.
The variable is providing access to the Environment Provider. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-6
There are a bunch of other Providers that are described here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_providers?view=powershell-6
As it says in the doco:
The model for data presentation is a file system drive. To use data
that the provider exposes, you view it, move through it, and change it
as though it were data on a hard drive. Therefore, the most important
information about a provider is the name of the drive that it
supports.
add a comment |
$env
is the Windows environment variables, the same as what you get when you do SET
in a command prompt. There are a few that are PS-specific.
The variable is providing access to the Environment Provider. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-6
There are a bunch of other Providers that are described here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_providers?view=powershell-6
As it says in the doco:
The model for data presentation is a file system drive. To use data
that the provider exposes, you view it, move through it, and change it
as though it were data on a hard drive. Therefore, the most important
information about a provider is the name of the drive that it
supports.
$env
is the Windows environment variables, the same as what you get when you do SET
in a command prompt. There are a few that are PS-specific.
The variable is providing access to the Environment Provider. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-6
There are a bunch of other Providers that are described here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_providers?view=powershell-6
As it says in the doco:
The model for data presentation is a file system drive. To use data
that the provider exposes, you view it, move through it, and change it
as though it were data on a hard drive. Therefore, the most important
information about a provider is the name of the drive that it
supports.
answered Mar 7 at 1:33
TrixTrix
443212
443212
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55034497%2fwhat-type-of-object-is-drivename-such-as-code-in-powershell%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown