19 July,2012 by Jack Vamvas
Question: I’d like to view the working directory on the powershell command line, like the pwd in Linux ? I’m experiencing problems when moving from drive to drive in the scripts , but not finding the location.
The other problem is to get the current directory during run-time and use in scripts.What cmdlet can I use to solve the above problems?
Answer: Use the Get-Location cmdlet.
(Get-Location -PSProvider FileSystem).ProviderPath
Add Get-Location to a variable and use it in the script. A typical use may be to display the information to a user or to move files.
Some good examples of Powershell Get-location are in these scripts.