Pregunta

I have a SCHTASKS Create based on an XML file that works fine with a static path.

However I need to run this on x86 and x64 and the program installs to Program Files (x86) on x64 machines, so this path will break. I don't want to have to keep 2 msi's.

<CustomAction Id="TaskCreate" Return="check" Execute="deferred" Directory="TARGETDIR" Impersonate="no"
  ExeCommand="SCHTASKS.EXE /CREATE /TN &quot;My Client Service&quot; /RU SYSTEM /RP /F 
       /XML &quot;C:\Program Files\MyProduct\Client_Task.xml&quot;" />

<CustomAction Id="TaskCreate" Return="check" Execute="deferred" Directory="TARGETDIR" Impersonate="no"
  ExeCommand="SCHTASKS.EXE /CREATE /TN &quot;My Client Service&quot; /RU SYSTEM /RP /F 
      /XML &quot;C:\Program Files (x86)\MyProduct\Client_Task.xml&quot;" />
¿Fue útil?

Solución

What about

<CustomAction Id="TaskCreate" Return="check" Execute="deferred" Directory="TARGETDIR" Impersonate="no"
  ExeCommand="SCHTASKS.EXE /CREATE /TN &quot;My Client Service&quot; /RU SYSTEM /RP /F 
      /XML &quot;[ProgramFilesFolder]\MyProduct\Client_Task.xml&quot;" />

[ProgramFilesFolder] is C:\Program Files for x86 machine and C:\Program Files (x86) for x64 mashine if you are making a x86 package.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top