「ファイル名を指定して実行」の所には何が?

このエントリーをはてなブックマークに追加
347青い紅玉
 def get_target(pathname)
  objLink = WshShell.CreateShortcut(pathname)
  return objLink.TargetPath
 end

 def reg_app(pathname)
  ext = ""
  begin
   if ext == 'lnk'
    pathname = get_target(pathname)
   end
   filename = (/\\([^\\]+)$/ =~ pathname) ? $1 : pathname
   dirname = $`
   basename = (/\.([^\.]+)$/ =~ filename) ? $` : filename
   ext = $+.downcase
  end while ext == 'lnk'
  appkey = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\#{basename}.exe\\"
  begin
   ifExists = WshShell.RegRead(appkey)
  rescue
   ifExists = nil
   ret = nil
  else
   ret = WshShell.Popup("#{basename} は既に存在します。上書きしますか?", 0, "キーの登録", 3 + 32)
  end
  if (ifExists.nil?) || (ret == 6)
   WshShell.RegWrite(appkey, pathname, "REG_SZ")
   WshShell.RegWrite("#{appkey}Path", dirname, "REG_SZ")
  end
 end

 WshShell = WScript.CreateObject('WScript.Shell')
 objArgs = WScript.Arguments
 if objArgs.Count > 0
  for i in 0 .. objArgs.Count - 1
   reg_app(objArgs.Item(i))
  end
 end
 exit