How To Supercharge Windows' 'Send To' Option With AutoHotKey

I'm a real stickler for organising my files on my computer. Every file type has its right place to be within my directory structure. I regularly cut and paste files from my download/USB/wherever folders, and then paste them into the right location, after navigating to that folder, but I wanted to do it a better way. I wanted to be able to right-click on the file, and then send it to its destination, with only one click (well, two if you count the right click).

USB key picture from Shutterstock

Now Windows has its 'Send To' option in the right click menu, however that copies the file. I would obviously then have to remember to delete the file from the source directory once the copying was completed. This would be a fine solution, however I wanted to do it even quicker than that. And that also leaves open the problem of possibly not knowing which files have been transferred when sending multiple files).

There is also the option of adding the 'Move to Folder' (usually found in Edit > Move To Folder) to the right click menu, but this pops up a directory chooser, which means I would then have to find the folder that I want the files to go to. This would prove to be slower than simply cutting and pasting.

In comes AutoHotKey. If you're unfamiliar with AutoHotKey, you should check it out here. Basically it gives incredible power to be able to automate tasks on your computer.

I first created a very simple script that I saved into the Windows 'Send To' folder (C:\Users\{username}\AppData\Roaming\Microsoft\Windows\SendTo), so it would appear in the Send To menu when I right click on a file. The script reads in the file name(s) of the file that was right-clicked on, and then, using the built in FileMove function of AutoHotKey, moved to the destination that I have set.

This worked perfectly for most files, however for big files (multiple GBs), there was no feedback to show the progress of the file transfer. The cursor would have the loading icon, which would eventually disappear, and then a short time later, the file would disappear too (into the destination directory). So I decided I would interface my script with a file transfer program, TeraCopy (check it out here). TeraCopy allows for parameters to be passed to the executable when it's run, which would initiate either a Copy or a Move, so I took advantage of this.

I replaced the call to FileMove in my AutoHotKey script with a call to the Run command, and gave it the full path to TeraCopy, then 3 parameters:

  • Move - indicating to TeraCopy that I want to move the file,
  • Source - The source filelist, preceded with a * to indicate to the program it was reading in a list of files.
  • Destination - The directory to be moved to.

And that was it. Now my Send To menu will actually do as it says, and send the file to the directory chosen, not send and keep a copy. For an organisation freak like myself, this is going to make that organisation so much more efficient.

I've placed the script in this post, so you can check it out, customise it, and make use of it yourself!

This won't be the final version of the script, it's literally the very first version, that I wrote this morning in about 10 minutes, and thought that it would be a great starting block for people out there who might want something similar. I have a few of these scripts, that all do the same thing, but go to a different directory, however I may look at consolidating them all into one script, and having the destination determined dynamically in the script, depending on the extension of the file being moved. All possible thanks to the awesome power of AutoHotKey.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;After being launched from Send To
Destination = D:\Movies

;Loop through the files that were selected
Loop %0% {
	GivenPath := %A_Index%  ;Retrieve the short file name of each file that was selected
	Loop %GivenPath% {
		LongPath = %A_LoopFileLongPath% ;Get the files long name (full path)
		FileAppend, %LongPath%`n, C:\tmp\filelist.cmd ;Add the filepath to the filelist
;Pass the filelist to TeraCopy, tell it that it's a list, and to move the files to the Destination
RunWait C:\Program Files\TeraCopy\TeraCopy.exe Move *C:\tmp\filelist.cmd %Destination%

;Delete the filelist, after TeraCopy has completed
FileDelete, C:\tmp\filelist.cmd

To use this script, you need to download and install AutoHotKey, then create a new .ahk file in your 'Send To' directory (see above for location). Paste the above code, update the variable Destination and also the path to TeraCopy (if different). Save the script, and you're ready to go. Just right click on a (or many) files, go to Send To, and select the name of the script from there, and the magic will happen.

One limitation: The script can't move folders yet, it only works on files. I will figure out how to fix that and update when that's done.

Hopefully someone else will find this useful also.

Making Windows' 'Send To' More Powerful With AutoHotKey and TeraCopy [Denno's Blog]

Luke Denton aka Denno is a technology student and enthusiast.


    Loop %0% - what is the variable 0?
    GivenPath := %a_index% - you are literally assigning 'GivenPath' the loop's iteration number, not short file name as claimed in comment?

    Agree with AHK User.
    Also, think it's easier just to hold down Shift key while selecting target in the SendTo menu to move single/multiple files and/or folders instead of copying.
    Extra tips:
    - hold down Ctrl+Shift combination to create shortcut instead
    - also works for drug-&-drop operations
    - hold down Shift when Right-clicking objects (Shift+Right-click) to access extended context menu AND extended SendTo menu (on Windows7)
    - create shortcut for the SendTo folder in the SendTo folder and then use first tip to quickly send shortcuts for programs or folders directly in to the SendTo menu. Instantly adds destinations for your files/folders!

Join the discussion!