Don’t type, drag to the cmd window
I spend a good deal of time with a Windows cmd.exe window open on my desktop. If I’m not running the DITA OT, I’m testing some Perl script, or Ant, or Python, or who knows.
A few years ago (in the Windows 98 days), I discovered a nifty cmd window trick. People are consistently amazed when I demonstrate it to them. Now I’m going to share it with you.
Say you need to change directory to some long and gnarly path name. You could type the whole thing in. Or, if you have Windows Explorer open on your desktop, you can:
- Type “cd ” in the cmd window (the space is important).
- Go to Windows Explorer and find the folder you want to navigate to.
- Drag and drop the folder from Windows Explorer to the cmd window.
Hey presto! The path name is copied to the cmd window. What’s more, if there are spaces in the path, the path is automatically quoted.
Now you can click in the cmd window and press Enter to perform the command.
Cool! No more typing long path names for this ToolSmith.
This works for filenames too. If I’m running a Perl script that needs to work on a file way down my directory tree, I type “perl myScriptName.pl “, then drag and drop the file name from Windows Explorer into my cmd window.
I’ll keep adding more ToolSmith’s Tricks as I use them. What’s your favorite trick?
Astounded
Incredible. I never knew this. It’s 2023 and I’ve been using DOS since the 80’s. *shakes head*
Thanks!