15.1. Exploring System State

The Windows PowerShell shell maintains information about your system's current state. The information that the Windows PowerShell shell maintains about system state is summarized in the following table.

InformationDescription
Current Working LocationThe default location used by commands such as get-childitem if no path is explicitly provided
Error handlingDefines how errors are to be handled
NamespacesContainers for names that ensure that any fully qualified name is unambiguous
Shell aliasesThe aliases created by default when you start the Windows Power-Shell shell
Shell functionsThe functions created by default when you start the Windows Pow-erShell shell
Shell variablesThe variables created by default when you start the Windows Power-Shell shell

The sections that follow describe how you can access information about the system state.

15.1.1. Using the get-location Cmdlet

The get-location cmdlet lets you find the current working location in the context of a specified Windows PowerShell provider, which is supplied explicitly or by default. The get-location cmdlet supports the common parameters (covered in Chapter 6) and the parameters in the following list:

  • PSProvider — specifies which Windows PowerShell provider to query. The default value is the current working provider.

  • PSDrive — specifies a Windows PowerShell drive to query

  • Stack — When specified displays the items on the current stack.

  • StackName — Specifies the name of a stack for which the locations on ...

Get Professional Windows® PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.