PowerShell supports not just the file system, so you can set the current path to a different provider (Set-Location). Here is a trick that always gets you the current file system location no matter which provider is currently active:
PS C:> cd hkcu: PS HKCU:> $ExecutionContext.SessionState.Path CurrentLocation CurrentFileSystemLocation --------------- ------------------------- HKCU: C: PS HKCU:> $ExecutionContext.SessionState.Path.CurrentFileSystemLocation Path ---- C: PS HKCU:> $ExecutionContext.SessionState.Path.CurrentFileSystemLocation.Path C:
Throughout this month, we’d like to point you to two awesome community-driven global PowerShell events taking place this year:
Europe: April 20-22: 3-day PowerShell Conference EU in Hannover, Germany, with more than 30+ speakers including Jeffrey Snover and Bruce Payette, and 60+ sessions (www.psconf.eu).
Asia: October 21-22: 2-day PowerShell Conference Asia in Singapore. Watch latest annoncements at www.psconf.asia
Both events have limited seats available so you may want to register early.
ReTweet this Tip!
Posted Jan 11 2016, 06:00 AM by ps1