Copy current location to clipboard

How do I copy the current working directory to the clipboard?

PS C:\jacek> pwd | CLIP

      

I am getting content as shown below. How can I only copy the location / value without any spaces or descriptions?

Path
-
C: \ jacek
+3


source to share


2 answers


Update your code to just return Path

:



(pwd).Path | CLIP

      

+10


source


In PowerShell 5.0 and up, you can also use

(pwd).Path | scb

      

or



scb (pwd).Path

      

where scb is an alias for Set-Clipboard

Documentation is available at https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-clipboard?view=powershell-5.1

+4


source







All Articles