HOWTO: Create a Perl Shortcut That Acts Like a Drop Target In Windows

UPDATE: I recently installed ActivePerl on a new Windows XP system, and I did not need to take any special actions to make perl scripts into drop targets. YMMV.

If you use perl on Windows, you've probably got at least one script that you'd like to be able to put on your Desktop and drag-and-drop files onto to perform some function on the dropped files. There are at least two ways to accomplish this.

  1. If you've installed Active State Perl, every perl script with the ".pl" file extension on your system is associated with perl. You can make every one of these perl scripts a drop target by creating a Drop Handler as follows: Create a new registry key "shellex" under the "HKEY_CLASSES_ROOT -> Perl" key with a default value of {86C86720-42A0-1069-A2E8-08002B30309D}. You can do this manually, or save and run this .REG file to modify your registry automatically.
  2. Alternatively (or in addition), you could create a shortcut to Perl and add the path to the perl script as an argument, e.g., in the "Target" field of the shortcut properties, type "C:\Perl\bin\perl.exe" "\PATH_TO_YOURSCRIPT\". The shortcut will automatically be a drop target whether or not you implemented the registry change above. (You could also create a shortcut to wperl.exe, rather than perl.exe, and eliminate the DOS box.)