Hi,

I have a Wix project in which I am trying to add a shortcut to a command
prompt which calls a batch file as a command line argument.  With the code I
have so far (see below), I can get it to work on Windows XP only, because
the environment variable it's using to find the cmd.exe program is
determined at compile time (and it's being compiled on an XP).

It doesn't work on Windows 2000 because the system32 directory is not under
"Windows" but rather, under "WINNT".  The shortcut appears on the start menu
on Windows 2000 systems but, clicking on properties displays the line:
"C:\Windows\System32\cmd.exe /k projectvars.bat"...so it can't find cmd.exe.

Product.wxs:
------------------

<Property Id="COMMANDPROMPT">$(env.WINDIR)\system32\cmd.exe</Property>

(alternatively, $(env.ComSpec) could be used instead of
$(env.WINDIR)\system32\cmd.exe)


Files.wxs:
--------------

<Shortcut Name="Project Command Prompt" Target="[COMMANDPROMPT]"
Arguments="/k projectvars.bat" Id="CommandLineStartMenuShortcut"
WorkingDirectory="BinFolder" Icon="ProjectVarsIcon.exe"
Directory="ProjectToolsProgramMenuFolder">
          <Icon Id="ProjectVarsIcon.exe" SourceFile="cmd.ico"/>
</Shortcut>


Is there any way to modify this code so that it determines the value of the
environment variable at runtime?  Or, is there a way of setting a different
filepath so that it uses the Sys32Folder property somehow?  I briefly
attempted to change the property to:

<Property Id="COMMANDPROMPT">[Sys32Folder]\cmd.exe</Property>

to see if that could work...but was given the following warning when I tried
to compile it:

"If this value is a string literal, not a property reference, please ignore
this warning.  To set a property with the value of another property, use a
CustomAction with Property and Value attributes."

But wasn't able to figure out how a CustomAction would apply in this
situation.


Any help would be greatly appreciated!

Best Regards,
Alicia
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to