|Developer Tools||Office Productivity Applications
|PDFOne .NET||XtremeDocumentStudio .NET||PDFOne (for Java)||XtremeDocumentStudio Delphi||eDocEngine VCL||PDFtoolkit VCL|
If you work in a big company or if your files are scattered over several server shares, then you may often find yourself copying the path or the name of a file in Windows Explorer. The steps involved are simple but it may seem cumbersome when you do it several times a day.
If I am right, then you will be happy to know that you can use some context menu (shortcut menu) options to reduce the number of steps. In Windows XP, there are no such menu options. In Windows Vista and Windows 7, you can hold the SHIFT key and then right-click on a file to get a "Copy as path" context menu option. Unfortunately, this option has some limitations. Here are some:
At the bottom of this page, you can download two simple utilities that will provide more user-friendly context menu options. I had originally created them for my colleagues. I have seen the menu extensions working in Windows XP and Windows 7. I expect the extensions to work in Windows Vista also. However, these utilities were a personal project and are not endorsed or supported by Gnostice. For this reason, I have decided to provide full source code so that you can compile the utilities yourself. Test them. If it works, use them.
When the utilities are installed properly, Windows Explorer will get four new context menu options. Two of the menu options will be available for files and the other two will be for folders. These options will allow you to copy the path or the name of the file or folder that you have right-clicked.
The download zip file contains two folders. Each folder contains a small application written in Visual Basic 6, a
.reg installer file, a
.reg uninstaller file, and a readme text file.
The first utility is simply called Copy Pathname (arg2cp.exe). It copies path of the selected file or folder to clipboard. The second utility is called Copy Filename (arg2cn.exe). It copies the name of the selected file or folder to the clipboard. These applications are meant to be invoked by Windows Explorer. If you try to invoke them independently, you will get nothing but an error message.
.reg files are used in place of regular installation and uninstallation programs. The registry files create certain entries in the Windows Registry store. These entries cause Windows Explorer to provide the custom context menu options displayed above. When a user right-clicks a file or folder and selects one of the menu options, Windows Explorer will send the full path of the file or folder to the application (either arg2cp.exe or arg2cn.exe) specified by the relevant registry entry. The application processes the file/folder path information and copies the processed information to the clipboard.
Here are the contents of the
.reg file installer of the first utility.
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\Shell\Copy File Path\Command] @="\"C:\\Program Files\\Copy Pathname\\arg2cp.exe\" \"%1\"" [HKEY_CLASSES_ROOT\Directory\Shell\Copy Folder Path\Command] @="\"C:\\Program Files\\Copy Pathname\\arg2cp.exe\" \"%1\""
And, here are the contents of the
.reg file installer of the second utility, which copies the name of the selected file or folder.
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\Shell\Copy File Name\Command] @="\"C:\\Program Files\\Copy Filename\\arg2cn.exe\" \"%1\"" [HKEY_CLASSES_ROOT\Directory\Shell\Copy Folder Name\Command] @="\"C:\\Program Files\\Copy Filename\\arg2cn.exe\" \"%1\""
You can copy these registry entries to Notepad and save the file with a
.reg extension. You can use that file as your installer. Now, here is the VB6 source code for the arg2cp.exe.
Attribute VB_Name = "Module1" Sub main() Dim strPathname As String strPathname = Command strPathname = Right(Command, Len(Command) - 1) strPathname = Left(strPathname, Len(Command) - 2) Clipboard.Clear Clipboard.SetText (strPathname) End Sub
Here is the VB6 source code for the arg2cn.exe.
Attribute VB_Name = "Module1" Sub Main() Dim strPathname As String strPathname = Command strPathname = Right(Command, Len(Command) - 1) strPathname = Left(strPathname, Len(Command) - 2) strPathname = Right(strPathname, Len(strPathname) - InStrRev(strPathname, "\")) Clipboard.Clear Clipboard.SetText (strPathname) End Sub
There is no error-checking code because I trust Windows Explorer to pass file path information without any errors.
C:\Program Files. Please be careful. The folders need to be created only under the
C:\Program Filesfolder. If you wish to extract the folders to some other folder, then the installer
.regfiles need to be suitably modified first. Please be reminded that the new path in the
.regfile need to be escaped properly. Mistakes can be costly. The installer
.regfile that I have provided has been directly exported from my registry and is always expected to work, provided that you have correctly followed all my installation instructions.
C:\Program Files\Copy Pathnameor the
C:\Program Files\Copy Filenamefolder.
.regfile to display the context menu and select the Merge option. This will launch Registry Editor.
.regfile, select Yes, and later select OK to finish the installation.
To uninstall one of these context menu extensions, navigate to the
C:\Program Files\Copy Pathname or the
C:\Program Files\Copy Filename folder in Windows Explorer and run the
Uninstall_Copy_Pathname.reg reg file contains the following:
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\*\Shell\Copy File Path] [-HKEY_CLASSES_ROOT\Directory\Shell\Copy Folder Path]
Uninstall_Copy_Filename.reg reg file contains:
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\*\Shell\Copy File Name] [-HKEY_CLASSES_ROOT\Directory\Shell\Copy Folder Name]
.reg files delete the registry entries that were originally created by the installer
.reg file and Windows Explorer will no longer show those additional context menu options.
Sometimes, you may see two redundant menu options for ZIP files. This may be because you have installed Compressed Folders utility that comes with Windows. Compressed Folders makes Windows Explorer treat ZIP files as folders. To avoid this awkwardness, you can either uninstall the menu extensions or uninstall Compressed Folders. To uninstall Compressed Folders, use the following command in the Run dialog box of the Windows Start menu.
regsvr32 /u %windir%\system32\zipfldr.dll
Uninstalling Compressed Folder has another positive side effect - your file search operations become faster as it no longer searches inside zip files! However, to open zip files in the absence of Compressed Folders, you may wish to install a freeware zip utility such as IZarc and set it as the default application for file archive formats.
If you wish to restore Compressed Folders at a later point in time, enter the following commands, one after another, in the Run dialog box.
regsvr32 %windir%\system32\zipfldr.dll rundll32 zipfldr.dll,RegisterSendto
There have been few requests for adding more features to this utility. I would rather recommend Path Copy Copy project, which has more features.
|Our Free Online Document-Processing Tools|
Gnostice Apps provides several PDF document-processing services over the Web. It enables you to merge, split, convert, secure and redact PDF documents - all for FREE. All you need to access these services is a HTML5-capable browser such as the latest version of Firefox/Seamonkey or IE 11.
|Our Developer Tools|
A Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools.
A Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents.
A Delphi/C++Builder component to intelligently convert PDF to user-friendly Word RTF documents.
A .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications.
Multi-format document-processing component suite for .NET developers
A Java™ PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java™ applications.
Java font engine to render glyphs from Type 1, Type 2 (CFF), and TrueType fonts
|Our Office Productivity Applications|
A free, fast, and portable application for viewing, printing and converting PDF documents.
|Privacy | Legal | Feedback | Newsletter | Resellers||© 2002-2014 Gnostice Information Technologies Private Limited. All rights reserved.|