In 2008 I created a small program meant to be run from a terminal window called ccwd which copies the current working directory to the clipboard. While the standard Unix command pwd will print the working directory (that is, the current folder the terminal is in), this will copy it to the clipboard. I found myself using it all the time when I needed to get the directory that I was in.
Example usage in the Windows Command Prompt:
Microsoft Windows [Version 10.0.19043.1165] (c) Microsoft Corporation. All rights reserved. C:\Users\Al>cd Desktop C:\Users\Al\Desktop>ccwd C:\Users\Al\Desktop>
At this point,
C:\Users\Al\Desktop would be copied to the clipboard and could easily be pasted into other apps. I have the C source code and Windows executable here. ccwd.exe does not produce any output, and returns 0 on success and a nonzero value on failure.
I recommend placing the ccwd.exe file in the C:\Windows folder or someplace on the system PATH (i.e. one of the folders listed in your PATH environment variable).
UPDATE 2022/05/04: If you don't want to download the sketchy looking, unsigned .exe file from this page, you can download a batch file to use instead:
The code in this batch file is easy enough to understand. It uses the Get-Location cmdlet for Powershell (preinstalled on Windows 7 SP1 and later) to get the current working directory and stores it in a temporary variable. Then it uses Set-Clipboard to put the contents of this variable on the clipboard.
pwd | tr -d '\n' | pbcopy