Right Click a file; Copy Path to Clipboard

A simple but very convenient feature (found in another file manager):

Right Click a file and select "Copy Path to Clipboard"

Perfect to put into file save/open dialog boxes etc.

already exist...

select files and edit/copy file name...

u can create this command in the right clic.

settings/files type/all files and folders/contexte menu/new and...

In addition to what AlbatorIV suggested, you can also copy just the selected file name(s) without the full path with this command:

Clipboard COPYNAMES=nopaths


Sorry for being a novice, but I could not get the dialogue box you have. I followed your "path":

settings/files type/all files and folders/
Then double clicked on "all files and folders"
Selected "Context Menu"
and "New"

However I get a different window titled "Edit new action
for type: All files and folders".

What am I doing wrong?


The action edit window drop down fields look a bit different 'after' you've created an action than they do when you're initially 'creating' it. You should see a Type: dropdown box from where you'll want to select Run an Opus function (Not supported in Explorer) and then you should see the larger edit window.

I'm trying to replace several context menu utilities with DOpus functions. One is CopyPath, which is similar to the functionality described in this thread.

I've implemented CopyLongPathAndFileName, CopyShortPathAndFileName [8.3 form], CopyLongFileName, CopySortFileName, and CopyUNCFileName.

I'm having problems figuring out how to implement CopyLongPathNameOnly and CopyShortPathNameOnly while selecting a file name (so that this will work even if the folder tree is not present).

I'm new to DOpus, but reasonably experienced in scripting. If I could assign the clipboard results to variables and use string functions to trim one string based on the content of another string, I think I could use the existing raw commands to do what I want, but so far I've not seen anything that allows such constructs.

Any suggestions?

John Land

Viking: Are you good to go?

johnfland: Not sure if you can use this in the way you'd like to, but rather than getting the full path+selection info from Dopus Clipboard command into a variable and then using scripts to trim the last part of so that you're left with 'just' the path what if you could get that 'trimmed' info straight into a variable?

By using the SETX.EXE utility from Microsofts Win2k resource kit, you can get the path of selected items parent folder directly into a variable. If you copy SETX.EXE to a folder somewhere in your system search path, and create a context menu action to run:[b]runmode hide Setx MYPATH {sourcepath|noterm}[/b]...I'm hoping that should cut out the part of your needing to use any scripting to do the trimming, but not sure how you would then intend to use the value of the variable in subsequent commands...

Note: The utility has a caveat that the value you assign with it is not immediately available to a process running in the same CMD 'instance'. Example; open a CMD prompt, manually type SETX MYVAR myval and then type SET MYVAR and you will not see your assigned value. If you then open another CMD prompt and rerun SET MYVAR, you will see the value refelected properly.
I just mention this because if you intend to run some other commands after setting a variable this way, they might not be able to access the 'latest' value without doing some tricks.

You could use my little SetClip program to do this.

Long path:

runmode hide
SetClip.exe {s|noterm}

Short path:

runmode hide
SetClip.exe {ss|noterm}

Both assume that SetClip.exe is in the path, of course.

Caveat: I doubt this will work with file collections, but in a normal directory it will put the current path into the clipboard.

Cool... but I wonder if GPSoft would consider adding a longpath and shortpath option to the COPYNAMES clipboard switch.

nudel --

SetClip worked perfectly for single files! Thanks.

It would be nice if native DOpus commands were added for CopyLongPathOnly and CopyShortPathOnly, so that they would operate on multiple selected files.

John Land
former PowerDesk and Explorer Plus fan, and new convert to DOpus.

Yes, steje. Thanks it works :slight_smile:

One small detail though. There is sometimes a ~1 sec delay before the context menu opens. I don't experience this with the "other" filemanager.

Hmmph... is that only since adding the right click option for Copy Path to Clipboard? Are you showing all context menu items from Windows, or have you disabled the Windows context menu items in Preferences?

Nope, I have not disabled the Windows context menu. However, it is also showing in my other (=Fileprobe) filemanager...

The reason context menus in Opus don't always open instantly is that it includes all the 3rd party shell extensions that Explorer also shows in context menus. Presumably this other program does not, so if you want the same in Opus you can just turn off the extra items. You can also move them to a submenu so you only get the delay when you open the submenu.


In addition to the information in that GIF, there is also a new command in Opus which will create all the 3rd party items in one place, which is very useful if you just want to move them to a submenu:



Note that FileType CONTEXTMENU CONTEXTOPTIONS=windowsonly works fine in a file pane, nicely hiding the Windows menus on a submenu,
but not in a folder pane -- the submenu is blank. Have to press SHIFT to get the regular Windows menus to appear in the main context menu list (I try to avoid key combos since I use a Tablet PC, and shift, ctrl, and alt are not handy).

John Land

Seems fine to me on a folder:

In my case I've got it on the All Files & Folders filetype (only) and it's in a submenu with a few other items, which may or may not be significant:

It works fine when clicking on a folder that is in the file pane -- but it doesn't work for me when clicking on a folder in the FOLDER tree pane to the left of the file pane.

John Land

Ahh, got you and confirmed. I've filed a bug report.

I think I was quite tired yesterday and/or wearing my Cursed Bracelet of Reading Comprehension -3. :slight_smile:

I can not figure out how to get this to work. I am also trying to create a right click (or button) command to copy the file path to the clipboard. How would I do either?

I followed the original instructions:

settings/files type/all files and folders/contexte menu/new and...

I got into the edit window.
I then added the command "Image", but that didn't work...
What should I write in the Edit window?

The word "Image" is appearing in some of these five-year-old posts because they had links to external image hosts which no longer exist. It's just a placeholder. I corrected one of the posts but don't have the images for any of the others.

There is an Image command but it's not related to copying paths to the clipboard. For the correct commands, see this FAQ:

HOW TO: Copy selected filenames to the clipboard