File.windowsShortcut

File.windowsShortcut

In this example, the windowsShortcut method is used to add a shortcut in the Program directory ("Program" is a keyword for the directory in which the program itself is installed, for example, C:\Program Files\Netscape\Netscape 6\" on Windows) to Windows software (misc.exe) that is installed in the "Windows" directory.

var xpiSrc = "misc.exe";
var vi = "1.1.1.1";
initInstall(
  "Windows Shortcut",
  "test",
  vi,
  0);
f = getFolder("Windows");
g = getFolder("Temporary");
addFile(
  "miscshortcut",
  "2.2.2.2",
  xpiSrc,
  f,
  xpiSrc,
  true);
target = getFolder(f, xpiSrc);
shortcutpath = getFolder("Program");
err = File.windowsShortcut(
  target,
  shortcutpath,
  "misc shortcut",
  g,
  "",
  target,
  0);
logComment("file.windowsShortcut returns: " + err);
if (0 == getLastError())
  performInstall();
else
  cancelInstall();