(I don't speak English. Hope you understand.)
Hi, I have a powershell script(.ps1) and it needs to work with the current path(e.g. "C:\Users\user\Desktop"). I don't know how to set it into a variable. I know the variable $PWD, but it is:
Path ---- C:\Users\user\Desktop and I need it without 'Path ----'.
Thank you for the answers, Andrew
11 Answer
Here are some ways to do that. basically you just need to expand the path property.
PS C:\WINDOWS\system32> $PWD Path ---- C:\WINDOWS\system32 PS C:\WINDOWS\system32> $PWD.Path C:\WINDOWS\system32 PS C:\WINDOWS\system32> $PWD | select -Expand Path C:\WINDOWS\system32 PS C:\WINDOWS\system32> (get-location).path C:\WINDOWS\system32 1