1

I want to deploy my app with an wix based installer and also want it to be available in the Command line, so that I can call my app after installation just like this:

C:\> myApp "Some parameters"

I know that I can achive this by adding my installation directory to PATH, but I need a bit more.

I would like to call my app by another name, for example my app is named like

MyApp.Cli.exe

and for a few reasons I would like to keep that naming scheme in the install folder. But on the command line I would like to call my App like

C:\> MyApp

instead of

C:\> MyApp.Cli.exe

Any ideas how to achive this? Thank you a lot for any help.

1 Answers1

1

App Paths: I suppose you can try App Paths? It is an alternative to updating the PATH variable. I don't think it works via the command line, but it works in the Windows Shell - or in other words when you do Windows Key + R and type in "YourAppName" (without the quotes), then you run the right application without updating the systems PATH variable.

Reminder: Remember to test on all OS versions you intend to support!

Note on WiX:

Sidenote: The WiX toolkit does something interesting. It adds its own environment variable WIX and sets it to the path of the toolkit's installation folder. Hence you can do this in scripts and the cmd.exe window: "%WIX%bin\candle.exe" in order to launch the binary in question (candle.exe, light.exe, etc...).

App Paths, Registry: In the registry your App Path would look something like this:

[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MyApp.exe]
"(Standard)\Your Path Here\Your Path Here\MyApplicationFullName.exe"

Actual reg-file:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\DaTool.exe]
@="C:\\Program Files\\My Tools\\DaFullNameOfDaTool.exe"

WiX Markup: Running heat.exe reg MyRegExport.reg -out MyWiXFile.wxs -sfrag -suid to convert the exported *.reg file to WiX markup yields something like this (not tested, please adjust as appropriate - just a generalized idea of how to do this):

<Component>
  <RegistryKey Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\DaTool.exe" Root="HKLM">
    <RegistryValue Value="[ProgramFilesFolder]DaFullNameOfDaTool.exe" Type="string" />
  </RegistryKey>
</Component>

Command Line: It seems it works to use the "start" command from a command line window:

start datool

But it does not work to just go datool. Didn't test much, have a play with it?


Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164