How it works...
PowerShell is built with some variables that control its behavior, and administrators are allowed to modify some of them to suit their needs. Some variables, however, cannot be modified; they are contextual and add some amount of flexibility (or modularity, as the case might be) to the shell.
One such example would be $PWD, which contains the path of the present directory. This variable changes itself based on the execution of Set-Location. Values cannot be explicitly assigned to such variables; setting values explicitly would have no effect on the behavior of the shell.
Some variables, on the other hand, accept values and let us control the execution of commands and scripts. We shall look at an example in the next recipe. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access