0

I want to get current working directory in powershell, which I do with pwd which gives me output like:

Path
----
C:\Users\Ian\source\repos\python\Modules\Hub

However I want to copy this to the clipboard with pwd | clip but the output with the header doesn't really paste nicely into single line text fields.

How do I get just the path (e.g. "C:\Users\Ian\source\repos\python\Modules\Hub")?

I tried pwd | Select-Object -Property Path | clip but it didn't make a difference.

Ian Newson
  • 515
  • 4
  • 14

1 Answers1

0

I found a solution with:

pwd | foreach {$_.Path} | clip

I'm hoping there's a more concise way however.

Ian Newson
  • 515
  • 4
  • 14