From: "shyouhei (Shyouhei Urabe)" Date: 2012-08-08T17:49:35+09:00 Subject: [ruby-core:47070] [ruby-trunk - Bug #6843][Rejected] win32ole save shortcut fail on Windows XP Issue #6843 has been updated by shyouhei (Shyouhei Urabe). Status changed from Open to Rejected Not a bug. ---------------------------------------- Bug #6843: win32ole save shortcut fail on Windows XP https://bugs.ruby-lang.org/issues/6843#change-28724 Author: mghomn (Justin Peal) Status: Rejected Priority: High Assignee: Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20) [i386-mingw32] The following program will success on Windows 7, but fail on Windows XP ======================================================================= Error message: (in OLE method `Save': ) OLE error code:80070003 in WshShortcut.Save C:\Documents and Settings\...... HResult error code:0x80020009 Exception occurred. ======================================================================= #!/usr/bin/env ruby -w -Eutf-8:utf-8 # encoding: utf-8 require 'win32ole' module Shortcut USERPROFILE = ENV['USERPROFILE'] def self.gen my_exe, my_params, my_dir, my_desc wsh = WIN32OLE.new('WScript.Shell') link = wsh.CreateShortcut("#{USERPROFILE}\\Desktop\\#{my_desc}.lnk") link.TargetPath = my_exe link.Arguments = my_params link.Description = my_desc link.WindowStyle = 3 # WindowsStyle.showmaximized link.WorkingDirectory = my_dir link.Save end end if $0 == __FILE__ ComSpec = ENV['ComSpec'] Shortcut.gen(ComSpec, '/c ver', Shortcut::USERPROFILE, 'OSVER') system("#{ComSpec} /c #{Shortcut::USERPROFILE}\\Desktop\\OSVER.lnk") end -- http://bugs.ruby-lang.org/