55

I want to create an installer EXE with some specific properties:

  1. it should be a single exe file
  2. it should be robust (i.e. the technique should be known to work well on any Windows system)
  3. it should create only a single file (a .scn screensaver file) in %systemroot%
  4. it should add the option to uninstall that particular file in "Control Panel -> Add or Remove Programs" but without creating any new entry C:\Program Files or copying an uninstaller.exe somewhere.

I've seen installers that work like that - so how to do this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mat
  • 11,263
  • 10
  • 45
  • 48
  • 8
    Does it have to be an EXE? Most Windows Installers are built as MSI (Microsoft Installer) now.. =) – Rob Jul 02 '09 at 12:13
  • 68
    If you do come up with a solution, be sure to send a copy to Microsoft. They haven't managed it yet. – jalf Jul 02 '09 at 12:15
  • ah well yeah - it meight be an MSI as well, as long as MSI installer files can be installed on any windows machines without prerequisites – Mat Jul 02 '09 at 12:15
  • The correct version of Windows Installer is a prerequisite for MSIs, but that should be on pretty any Windows system (and if it was missing most setups would fail). – Dirk Vollmar Jul 02 '09 at 12:17
  • 5
    Hmm... If it's only copying a single file around, and that file is a program anyway (scn screensavers are just renamed exe's), why not make that one program have three different modes? "run without parameters" == copy to %systemroot%, display dialog box "thanks for installing". run with parameter /s == display screensaver. run with parameter /u == uninstall (delete from %systemroot%). – Stobor Jul 02 '09 at 12:34

14 Answers14

34

Take a look at NSIS it is quite simple and it is used to create installers for Windows.

Otávio Décio
  • 73,752
  • 17
  • 161
  • 228
33

As you've said it can be an MSI, I'd suggest going down that route.

You could play around with installer projects in Visual Studio (if you have it; I'm not sure if the Express editions support making installers), as they'll quite happily produce an MSI that will do what you're asking. It's worth noting they'll produce an EXE and an MSI, you only need to distribute the MSI though.

Failing that, take a look at Windows Installer XML (WiX) as that will let you hand sculpt an MSI that does exactly what you want it to do and will cater for all five of your points above.

Note: Using an MSI will mean that you'll need to have Windows Installer on the machine you're installing to - It's in-box from Windows 2000/ME upwards.

Rob
  • 45,296
  • 24
  • 122
  • 150
  • 7
    No, the Express versions dont support making installers. – Martin Jul 02 '09 at 12:29
  • So i gave Visual Studio and the installer project a try, but the created MSI wants to create a Folder in the windows "Program Files" folder. I could not remove that from the installer since it told me that this is a required folder and cannot be removed :( So now i'm going to give NSIS a try... – Mat Jul 02 '09 at 12:45
  • 3
    WiX has been recommended by the Microsoft Windows Installer team - quite a recommendation. http://blogs.msdn.com/windows_installer_team/archive/2006/05/12/595950.aspx – MarkJ Oct 19 '09 at 15:49
  • 2
    InnoSetup should be recommended before trying WiX (or anything else). It's so much simpler, involves practically no learning curve, is free even for commercial applications and doesn't leave anything to be desired imo – dominik andreas May 31 '17 at 21:01
23

I've heard good things about the free installer Innosetup, and the website says it can create single EXE installs.

MarkJ
  • 30,070
  • 5
  • 68
  • 111
  • For start Inno Setup is better, because have an Wizard to make the setup file. – Nathan Campos Jul 13 '09 at 17:36
  • Innosetup is very easy, just copy the example file and add the name of your own exe. You don't need the pascal scripting unless you need to o something very complex – Martin Beckett Sep 06 '09 at 01:17
  • 1
    I've worked extensively with NSIS, tried IExpress, took a deeper look at WiX and have now tried InnoSetup. I must say the latter beats all other solutions by a long shot. – dominik andreas May 31 '17 at 20:57
  • 3
    I tried Innosetup based on this answer, and I was able to get an installer in under an hour. It took one or two more hours to figure out how to get my program to run after install, start on boot, and to copy files based on wildcards. Overall, easy and flexible, I recommend. – prewett Jun 07 '17 at 21:40
6

Try Advanced Installer, I think it can do all that you ask. I use it for slightly more complex installers but the free version is easy to use and powerful.

There can be an issue with MSI files, older PCs don't have the latest Windows Installer, 3.1, so you need to install that or prompt the user to, first! Have you looked into using IExpress if you just want to copy a file across?

Martin
  • 2,442
  • 14
  • 15
5

Both NSIS and Inno Setup will cope with all the tasks specified. Inno Setup uses a Pascal-like language for its scripts, NSIS uses its own script language.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
justadreamer
  • 2,410
  • 2
  • 21
  • 24
4

It come to my attention that this answer is still being read. This answer is over 5 years old and much of the information here may not be relevant anymore. Using IExpress also comes with its risks as well, which you can learn more about here.

If you wish to proceed anyways, here is the old answer:

IExpress

You can use Microsoft Windows's built in installer wizard called "Iexpress". To access that, open "Run", which is done by hitting Windows Key and R at the same time(WindowsKey+R). When you get in "Run", type in the little box "iexpress.exe". Then hit enter. You are there!

Notes: Only available on Microsoft Windows (Legit, and NonLegit)

Setup Explained:
Page 1

  • Create a Self Extraction Directive file.
    Makes a new installation file
  • Create a Self Extraction Directive file.
    Edits a .SED file
    Page 2 (Of Create a Self Extraction Directive file.)
  • Look in the "Description" at the bottom
    Page 3
  • Package Title
    The name of your installer, as displayed at the top
    Page 4
  • Confirmation Prompt
    What to tell the user before installing
    Page 5
  • License Agreement
    Skip if you don't know what this is
    Page 6
  • Packaged Files
    What files you need to install
    Page 7
  • Show Window How the window is displayed
    Page 8
  • Displayed At Top Page 9
  • Package Names and Options Where to save your File
  • Hide File Extracting Progress From User Hides the animation
  • Store File using Long Name inside installer Ignore if you don't know what this is Page 10
  • Displayed At Top
    You are done!
    Click on the Title to download the file, without doing those instructions. If it is a virus, got infected or you think it is a virus, feel free to delete the file.
MineCMD
  • 404
  • 5
  • 13
2

You can create a single installer file using just Visual Studio 2017 Pro and Windows in 3 steps:

  1. To have an entry in the Add/Remove Programs, you need to have a setup project.
  2. The setup project may compile into 2 files: *.msi and setup.exe
  3. To create a self-extracting package, you can use the IExpress tool
  • 1
    Just what I need. Thanks – Believe2014 Jun 28 '17 at 23:10
  • I think this answer would be even better if you could post some more details of it here, instead of linking to that video on Youtube. You see, links to external websites can always become invalid (Youtube won't close down, but they could remove the video, for example), and without that video this answer wouldn't really help much. So please [edit] it and add something more. Besides, compared to text, videos aren't great for usability (you can't search their content, you can't print them, they require a couple of minutes instead of a few seconds for a quick scan...). Thank you! – Fabio says Reinstate Monica Jun 28 '17 at 23:15
  • Thanks for your heartfelt comment. I wish that StackOverflow has a feature to host tutorial videos so that we don't have to host it on another platform. –  Jun 29 '17 at 01:59
1

NSIS, MSI any installer can do that for you.

NSIS is pretty small and compact.

dr. evil
  • 26,944
  • 33
  • 131
  • 201
1

The not copying an installer somewhere and adding an entry into Add/Remove seem to be counteractive. My understanding is that add-remove programs neccesarily references a copy of the uninstaller that resides in a Windows directory (so it doesn't lose access to it).

Perhaps you could have the screensaver double as an uninstaller if you pass it some sort of command-line option. Then simply tell the msi that the uninstaller IS the screensaver (hence no unnecessary coping to some other directory.)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ape-inago
  • 1,870
  • 1
  • 13
  • 27
  • With an MSI, Windows caches it in %windir%\installer anyway, so it doesn't create any files in %programfiles% or anywhere else, which I guess probably satisfies the spirit of point 5, if not the exact wording =) – Rob Jul 02 '09 at 12:27
  • 1
    it seemed very specific "or not coping uninstaller somewhere"... cacheing vs coping? – Ape-inago Jul 02 '09 at 13:02
  • caching is actually fine if that chache folder is hidden from the user anyway – Mat Jul 02 '09 at 13:11
1

NSIS is the way to go, very simple to learn, just write a simple file specifying which files you want to install over where. You can also add QuickLaunch options and so on. Then run the NSIS compiler and you get the exe.

Nikhil
  • 286
  • 3
  • 8
1

InstallShield has a release option called "Single .EXE". It can bundle the payload inside, plug register w/Add-Remove Programs as you specified.

William Leara
  • 10,595
  • 4
  • 36
  • 58
1

Try the CQtDeployer tool. This tool using the Qt Installer Framework for create installers and supports Windows and Linux platforms.

  1. Install the cqtdeployer tool. I am recommended use the online installer, because it has the latest version of cqtdeployer with minor bug fixes.
  2. Open the cmd with your framework envirement.
  3. Run the cqtdeployer for your application on the cmd.
cqtdeployer -bin path\to\myApp.exe qif 

If you use Qt then add the qmake option.

cqtdeployer -bin path\to\myApp.exe -qmake path\to\qmake.exe qif 

For more examples of using this util see the CQtDeployer Wiki

Andrey Yankovich
  • 868
  • 9
  • 13
0

If you want to use standard deployment methods with your installer you probably should stay away from NSIS. See http://unattended.sourceforge.net/installers.php for an overview.

ko-dos
  • 1,420
  • 12
  • 11
0

I recommend using the Microsoft Visual Studio Installer Project. It is pretty easy to use.

https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects

You can install it as an extension in visual studio.

Chris S.
  • 131
  • 1
  • 7