Getting path and file name into paste buffer?

What is the easiest way to write the path and name of a file into a text document, if I’ve already navigated to the file with Windows Explorer?

What I do now is select the text in the address bar and copy and paste it into the document, and then doubleclick the text of the filename in the main pane (as if I were going to change it) and copy and paste that into the document. I have to add a backslash between them, too.

Is there a more direct way?

“Just type it” doesn’t count as more direct here. Assume the path and name may all be long and contain arbitrarily complicated combinations of legal characters.

Thanks!

I don’t know of a built-in way to do that. I have the same need you do and have been doing the same thing you do.

It would be trivial to write a tiny program to do that which could be attached to the right-click menu of all files. So your file’s context menu would have a new entry like “Save complete path and name to clipboard”. After choosing that you would select your document & paste. If I get up the gumption I may whip one up, and if so, I’ll post back here.

I did a quick search for existing freeware like that and nothing was immediately obvious. I also suck at locating freeware for particular tasks, so don’t take my failure as high quality data.

Now it seems surprising there isn’t something available doing that - or a feature in Explorer.

Unless somebody who doesn’t suck at locating freeware doesn’t tell us of one, that is…

There is a utility from PC Magazine called FileGrab that facilitates doing just that.

Note that there appears to be another utility on the web by the same name that does a different function.

go to run and enter cmd to open a cmd or dos window

dir *.doc stdout>files.txt

will create a listing of all your doc files in files.txt

open that and you can copy/paste the file names into your word doc

by default cmd opens a window into your documents and settings folder
you can move into my documents with
cd .\my documents

I have been annoyed by the need to do this for some time, so I just now went ahead & created something which does this pretty neatly.

If anyone wants to trust me that this isn’t malware, you can download the installer from http://www.angelfire.com/cantina/lastchance/CopyCmdlineArgsToClipboard.msi

The .Net Framework 2.0 is a prereq, but most modern PCs should already have that.

Since I know **Napier **is a .Net dev, at least a little bit, I also uploaded the whole source solution as a zip file at http://www.angelfire.com/cantina/lastchance/CopyCmdlineArgsToClipboard_Soln.zip

Feel free to see how both the app & the installer work.

The program itself was 3 lines & took about 5 minutes. Getting the registry entries right so it appears in the context menu took another 15 minutes. Setting up a windows installer (msi) to make all this automatic & fool-resistant took 90 minutes.

Such is the life of a Windows dev.

The app itself can do more than be used as a context menu extension. It simply copies whatever is on its commandline into the clipboard. So for example, if you had a bunch of environment vars you could use a quick cmd file or shortcut to transfer them to the clipboard.

I forgot to explain what it does …

After installation you’ll have a new entry on the context (right click) menu for both files & folders. When selected for files, the complete path is sent into the clipboard. For folders, the clipboard gets the complete folder path ending with a “”. It works for local, mapped drive, and unc-pathed files & folders.

When you right-click the menu entry, nothing happens in the UI; all the action is backstage. So don’t sit there waiting for something to happen - it already did.

I’ve used this technique for years. I routinely use it to create 20,000-line batch files to copy files to specific locations with specific filenames.

Damn, LSLGuy, you’re allright! That was absolutely thoughtful! I will try it shortly! I look forward to investigating the code, too - thanks for providing that as well!

Aceplace57, thanks, I did know about that and often use it, but what I was really after was a quicker way to do it for just one filename. My typical application is using some application that I have to tell about a file, if the app doesn’t allow browsing for one. What LSLGuy describes does it, and I actually can’t picture a hypothetical functionality that would accomplish what I want more easily than what LSLGuy provides.

Aces!

Aw…

“This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package.”

It does not speculate that I might not have a valid Windows system right now, though that might be more relevant. Always the developer’s fault, isn’t it, MS?

Such is the life of a Windows user. I think I don’t have .NET V2 on this machine. I find folder C:\WINDOWS\Microsoft.NET\Framework with V1… subfolders in it but none saying V2. I guess I don’t have it here, but will try it tomorrow on my work PC which is much newer. You were right about being a .NET dev “at least a little”. A very little. This will be a nice example with which to edify and inspire myself.

Aceplace57, here you go, the above paragraph is almost an example of what I was talking about. If I wanted to indicate a file, and not just a folder, I’d have wanted this program to do it.

Not to sound stupid but if you’re using a MS product you can make the file name and path part of the footer (as well as time and date if that’s useful). This was SOP at my last job because we made a ton of changes and needed to know which revision we were looking at plus we needed a path name so other people could find the file.

You can also click the properties section of most programs and just copy the file name and path if you truly just want to copy and paste something.

I have always used a tool called PathCopy by Ninotech for this. Unfortunately, they seem to be no longer. Novell has a copy of the originalon their Cool Solutions website.

I recently used an updated tool, PathCopyCopy, on a machine and it seems to be true to the original.

This product adds things to the right-click menu for files and folders. You can even choose whether you want full path including filename, filename alone, UNC path, MS-DOS short filename or short path.
You can even select several files and right-click them to copy all of their paths to the clipboard.

It’s one of my favorite tools for working in Windows.
(I always install PathCopy, Vim, and Command Prompt Here on a Windows machine)

ETA: Here’s how you install the original…

Download pathc400.zip and unzip it to a temporary folder. Right click PATHCOPY.INF and choose install.

In windows vista and up, if you hold shift + right-click the icon, you get an option “Copy as path” which should do what you want.

In XP and before, if you drag an icon to a cmd window it would give you the text of the path. Then it’s easy to copy and paste from there (turn on the quickedit setting for your cmd windows).

Wow, this is a nice proggie. :smiley: I just used it to copy 15 file names and made a m3u play list file for a Christmas album. Worked great. I’ll keep this around for sure.

hmm, just noticed path copy has an odd bug. You’ll note that the last filename (18 - Selections from) got written out of order. Not a big deal. But, it’s something to watch for. Still, it’s a very useful program.

Carpenters, the - 18 - Selections from ‘Nutcracker’; Oveerture Miniature-Dance of the …flac
Carpenters, the - 08 - Santa Claus Is Comin’ To Town.flac
Carpenters, the - 09 - Christmas Song (Chestnuts Roasting On An Open Fire).flac
Carpenters, the - 10 - Carol of the Bells.flac
Carpenters, the - 11 - Merry Christmas Darling.flac
Carpenters, the - 12 - Christ Is Born.flac
Carpenters, the - 13 - O Holy Night.flac
Carpenters, the - 14 - Home For The Holidays.flac
Carpenters, the - 15 - Medley; Here Comes Santa Claus-Frosty the Snowman-Rudolph the …flac
Carpenters, the - 16 - Winter Wonderland-Silver Bells-White Christmas.flac
Carpenters, the - 17 - Ave Maria.flac

You can get the Framework v2.0 from http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en . The Framework also has an SP1 I beleive, but your normal Windows update will take care of that. The solution was built using Visual Studio 2005, but can be opened by later versions.

My use case, and why I went to the trouble to build the tool (all 3 lines of code & 4 registry values!) is that I often write install or upgrade documentation for internal use which reads like

  1. Obtain file \serverX\folder\folder\folder\folder\file.file.file.msi
  2. Install file from step 1, using options blah, blah, blah and so forth.
  3. Obtain file \serverZ\folderZ\folder\folder\folder\file.file.file.msi

    Being able to find the files in Explorer & then readily paste their fuill path into the doc I’m writing is very handy.
    Good tips from arseNal. Thanks. I did not know that about Vista & up.

That looks like the standard goofy Windows Explorer order when you select a range of files using click then shift-click.

that’s what I did. :wink: Clicked the first file and held down shift to get a range of files.

using ctrl-A to select all the files might avoid mixing up the order. I’ll try that.

If you click on the last file and the shift click on the first file rather than vice versa, you do get them in order – well at least n some programs I don’t know about this one.