#!perl use warnings; use Digest::MD5; use FileHandle; use File::Basename; use Win32; use Win32::Clipboard; my $md5 = Digest::MD5->new; my $filename = $ARGV[0]; my $fh = new FileHandle; if ($fh->open("< $filename")) { binmode $fh; # we'll just assume $md5->addfile($fh); } else { Win32::MsgBox("Could not read file $filename\nDoes it exist?", MB_ICONSTOP, "md5sum"); exit; } my $digest = $md5->hexdigest; my $CLIP = Win32::Clipboard(); $CLIP->Set($digest) or do { Win32::MsgBox("Could not set the clipboard. Things are strange here.", MB_ICONSTOP, "md5sum"); exit; }; my ($basename,undef,undef) = fileparse($filename); Win32::MsgBox("The MD5 sum for file \'$basename\' is now in the clipboard:\n\n$digest", MB_ICONINFORMATION, "md5sum"); #### Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\MD5 Sum] [HKEY_CLASSES_ROOT\*\shell\MD5 Sum\command] @="c:\\projects\\md5sum\\md5sum.exe \"%1\""