Feb 212014

I know most of my important file locations by heart. Whenever I need to do things that require typing out a file’s full path, such as copying a backup or taking a peek at logs, I can type those paths from memory without issue.

On the other hand, when I’m working with systems I’m less familiar with or have never seen before, my memory can’t help me. At this point I’ve always opted for copying and pasting the paths of the file into SSMS or wherever else I might need it. This works just fine, but I’ve always been annoyed that the path and file name need to be selected and copied into the editor separately.

Two rounds of copy and paste seemed a little much. There has to be a better way, and in fact there is. This has probably been present in Windows for quite a while, but I found out about it just this week. I’ve long known that holding down the shift key while right-clicking on a file brings up extra options in the context menu, but what I didn’t realize is that one of those options is “copy as path”.

This will copy the full path of the file, including the name, to the clipboard, and you can now paste it wherever you like.

The Catch

The only downside to this is that, as you can see in the image above, the file path is surrounded in double quotes. This is great for pasting into a command prompt, but you’ll need to replace them with single quotes when working in SSMS.

UPDATE: Webucator has done a video demonstrating what I show in this post. You can see all the details here.