BLOG
Wissenstransfer von IT-Spezialisten
| |

PowerShell: Working with Paths and Locations

PowerShell provides several Location-cmdlets for the work with directory paths. This post will show you a useful task for these commands. But this is only one cool thing you can do with the cmdlets and it’s meant to encourage you to experiment on your own.

Get-Location

When we open a PowerShell console, it will show us the actual working directory. If we want to identify this directory out of a script, we can do that with Get-Location. So far this corresponds to pwd on Linux or %~dp0 in a Windows batchscript.

1
2
3
4
5
PS D:\> Get-Location
Path
----
D:\

But Get-Location provides more functionality: we can get the „actual“ working path for an other drive or provider, e. g. the registry.

<The full post is only available in German>