Quick File Duplication in Windows

I love finding little shortcuts to help me get things done. Sometimes it’s through automation of processes I do occasionally and sometimes its through speeding up something smaller that I need to do frequently. In this post I want to share something that definitely falls into the latter category. Duplicating files in Windows Explorer.

A Quick Way to Duplicate Files in Windows Explorer

There are lots of ways to duplicate files in Windows, but the simplest to my mind is simply selecting one or more files, copying them and pasting them. The copy paste can be done through the window or context menu features but keyboard shortcuts are of course the king of speed in this case. A quick CTRL+c then CTRL+v gets the job done nicely. So how do you improve on that?

My Inspiration and My Problem

On the Mac one the main file manager I use is Pathfinder. It has a built in shortcut key to duplicate files (?+d). That’d one key combination less than in Windows explorer. Given the simplicity of the existing process that’s already a nice speed bump. For me though it goes a bit further.

Because I switch between operating systems I sometimes find if I have a momentary lapse in concentration that I use Mac-like keyboard shortcuts from on Windows. This surfaced as me pressing CTRL+d in Windows Explorer … which deletes the selected files. The entire opposite of what I actually want to do. In fact given the delete key deletes selected files why exactly does CTRL+d need to do the same thing?

Quite frankly, it doesn’t. On my PC it no longer does thanks to a little override I’ve put in place.

Enabling the Override

Windows Explorer doesn’t allow you to create macros or remap keys, but I use a piece of software to do a number of automation tasks on Windows that’s actually been designed to do just this sort of thing. AutoHotkey is an Open Source utility that through the use of scripted instructions can produce a variety of key triggered macros. You can use it for anything from text expansion through to what is effectively application level sets of automated actions.

I created an AutoHotkey script to re-map the CTRL+d key combination to CTRL+c followed by CTRL+v when Windows Explorer is the active window. This then duplicates the files and importantly for me no longer deletes them!

The script to do this is fairly simple.

;Override CTRL+d as delete in Windows explorer
;Use it to duplicate the file instead
#IfWinActive ahk_class CabinetWClass
    Send ^c
    Send ^v

The script needs to be running in AutoHotkey to work. It’s probably best to include this into or as the first item in a library of things you have running in the background rather than running just this as a separate AutoHotkey instance.

The #IfWinActive declaration line checks the classification of the currently active window. If it is CabinetWClass then AutoHotkey will identify this as Windows Explorer and apply the instructions specified beneath it. In this particular case “^d” provides the instruction to override the CTRL+d key combination. As is probably pretty obvious at this point the next two lines simply trigger a CTRL+c followed by a CTRL+v. Finally the return instruction ends the instructions that will be triggered by CTRL+d.


Because this is overriding a default delete operation I’d advise you to test this on your system before using it in earnest just to assure yourself that it is providing the required behaviour. Otherwise if it isn’t quite working for you then you’ll be fishing around in your recycle bin (or your backups) for the files you inadvertently deleted.

Should you have an issue with the key combination triggering while your script is running it is almost certainly going to be the active window classification that’s not quite right for your set-up. If you do have such an issue use AutoHotkey’s Window Spy Utility to get the class of the Windows Explorer window you want to take action on .


That’s all there is to it. A very simple AutoHotkey script changes the CTRL+d in Windows Explorer from triggering a press of DELETE a press of CTRL+c | CTRL+v.

If you find this useful why not let me know via Twitter?

Author: Stephen Millard
Tags: | autohotkey |

Buy me a coffeeBuy me a coffee

Related posts that you may also like to read