How to get long filename from ARGV

后端 未结 4 1416
野性不改
野性不改 2020-12-18 02:59

I want to make a tool that takes some filenames as parameters, but when I use this code:

ARGV.each do|a|
  puts \"Argument: #{a}\"
end

and

4条回答
  •  生来不讨喜
    2020-12-18 03:46

    I found the reason my script receaved short filenames, i had done a registry patch to enable the drag and drop on ruby scripts and schortcuts as follows

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\rbfile\ShellEx\DropHandler]
    @="{86C86720-42A0-1069-A2E8-08002B30309D}"
    
    [HKEY_CLASSES_ROOT\rbwfile\ShellEx\DropHandler]
    @="{86C86720-42A0-1069-A2E8-08002B30309D}"
    
    [HKEY_CLASSES_ROOT\RubyFile\ShellEx\DropHandler]
    @="{86C86720-42A0-1069-A2E8-08002B30309D}"
    
    [HKEY_CLASSES_ROOT\RubyWFile\ShellEx\DropHandler]
    @="{86C86720-42A0-1069-A2E8-08002B30309D}"
    

    But it had to be the following for LONG filenames

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\rbfile\ShellEx\DropHandler]
    @="{60254CA5-953B-11CF-8C96-00AA00B8708C}"
    
    [HKEY_CLASSES_ROOT\rbwfile\ShellEx\DropHandler]
    @="{60254CA5-953B-11CF-8C96-00AA00B8708C}"
    
    [HKEY_CLASSES_ROOT\RubyFile\ShellEx\DropHandler]
    @="{60254CA5-953B-11CF-8C96-00AA00B8708C}"
    
    [HKEY_CLASSES_ROOT\RubyWFile\ShellEx\DropHandler]
    @="{60254CA5-953B-11CF-8C96-00AA00B8708C}"
    

提交回复
热议问题