Stupid PowerShell Trick #2:
 
If you need to access your environment variables and your registry, use set-location!  Both can be accessed just like a drive.
 
To access the environment variables:
PS C:> set-location Env:
To access the local machine’s registry:
PS C:> set-location HKLM:
To access the current user’s registry:
PS C:> set-location HKCU:
To access your original C: drive use:
PS C:> set-location C:

What’s cool about this trick is that the registry and Environment variables are treated like drives. 

Cool, huh?
 
PS:  Thanks to Rick for pointing out that I didn’t tell the user how to get *back* to the original drive.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s