SendTo file’s name with path to clipboard with AutoIt

AutoIt Karl of AskTheAdmin had recently answered question about how to copy file’s path to clipboard in Vista . Windows XP doesn’t have such function natively and post had some 3rd party software suggestions in the comments.

It reminded me how easy it is to make custom operations using SendTo menu and simple AutoIt scripts.


SendTo is special Windows folder for setting up actions available from right-clicking file and choosing Send to sub-menu. It has few useful default actions and most of readers stop at that. But daring ones can improve that a lot!

SendTo folder resides in user profile folder:

C:\Documents and Settings\%username%\SendTo\

Shortcut to get there is Start > Run (Win+R) > sendto > Ok (Enter) . That opens same folder without having to browse there.

Command line argument

Lots of internal Windows mechanics work according to ancient DOS rules. When you use SendTo command what actually happens is following:

  1. Windows takes full name (including path) of file or folder you right-clicked
  2. and passes it to SendTo item you had chosen - in the form of command line argument.

So you can use absolutely anything (or shortcut to that anything) that accepts full file name as command line argument and SendTo would work perfectly with that.


So how complex it is to write custom program that would take file name passed by SendTo and copy it to clipboard?

If $CmdLineRaw Then ClipPut($CmdLine[1])


That’s all. Compile and put into SendTo folder.

  1. $CmdLineRaw is AutoIt macros that holds command line parameters (in string form), need to check so it is not empty.
  2. $CmdLine[0] holds number of arguments (we don’t need), $CmdLine[1] holds first argument.
  3. So ClipPut() sends first command line argument to clipboard.
  4. Exit exits.

Easy, isn’t it? It’s simple demonstration how SendTo allows to easily feed files into AutoIt program. Program itself can be as complex as needed.

Script https://www.rarst.net/script/copyfilename.au3

Microsoft How to Add Items to the “Send To” Menu in Windows XP

Related Posts


  • Salwa #

    Thanks for the information. I just learned something new :-)
  • Nihar #

    Great. Simple but effective script to ease the task of copying the filename path.
  • Haggis #

    Perfect! If I wan't to copy file names and paths from several files at the same time, how do I do that?
  • Rarst #

    @Haggis Bit of array magic. :) This version instead of sending to clipboard single value will send all of attributes array. Should work with multiply file names just fine.
    #include <Array.au3>
    If $CmdLineRaw Then _ArrayToClip($CmdLine,1)
  • Haggis #

    :) Works like a charm! Thank you!
  • Rarst #

    @Haggis You are welcome. :) If you have ideas for cool or convenient things to do with AutoIt you can send them my way - and they might turn into posts and code.