19 July,2012 by Tom Collins
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.
Powershell Get-EventLog and Event Log messages
Powershell , Excel charts and data presentation
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |