The Invent with Python Blog

Sat 28 August 2021

ccwd - A Copy Current Working Directory Command

Posted by Al Sweigart in misc   

In 2008 I created a small program menat 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



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.

C source code for Windows

ccwd.exe executable program

I recommend placing the ccwd.exe file in the C:\Windows folder or someplace on the system PATH.


Learn to program with my books for beginners, free under a Creative Commons license:

Take my Automate the Boring Stuff with Python online Udemy course. Use this link to apply a 60% discount.