Feb 19, 2011

Drag and Drop versus the DOS Command Prompt

In my previous post, I talked about how you can drag and drop a folder into a Terminal window instead of laboriously typing a file path. Since it's common on the Mac to have spaces in folder and even volume names, all those spaces have to be escaped when typing the name. Dragging and dropping does it for you. Now I have used a similar copy/past trick from Window's explorer for a while. And as an aside, yes it  still works under Windows 7, it just takes this:



Now you can hit CTRL-C to copy it and paste it into a command prompt…. BUT  being inspired by the Mac I wondered if drag and dropping would work under Windows and the Command Prompt. Oh I know you Mac bigots out there just sardonically scoffed, but read on.  I typed


(again with a following space) and then dragged a folder from the Explorer into the Command Prompt Window and this was the result


So remember, typing a really long folder path like this is a drag (sorry, couldn't resist).

About Me

My photo
Tod Gentille (@todgentille) is now a Curriculum Director for Pluralsight. He's been programming professionally since well before you were born and was a software consultant for most of his career. He's also a father, husband, drummer, and windsurfer. He wants to be a guitar player but he just hasn't got the chops for it.