Custom installer

From TotalcmdWiki
Revision as of 15:53, 19 October 2023 by White (talk | contribs) (→‎External links: Changed the description of CAB Create)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

It's possible to create a custom installer for Total Commander to install Total Commander with the options and content you want.

Before creating a custom installer, you should first check if the same can be achieved using the command line parameters of the official installers, because that's much easier.

Customize installation data

In order to create a custom installer, you first need to customize the installation data. This involves three steps:

  1. Extract the installation data from one of the original installers.
  2. Change the installation data.
  3. Repack the installation data.

Extract the installation data

  • In Total Commander, click on the installer (for example tcmd1052x32_64.exe) and select menu option Files/Unpack Specific Files (Alt+F9).
  • Remove the suggested folder and type INSTALL.
  • Click OK.

A folder named "INSTALL" is now created containing the installation data.

Change the installation data

The file INSTALL.INF is a text file containing the most important settings for the installation. The installer for Total Commander 64+32-bit also contains the file INSTALL64.INF. This file is used when using this installer on a 64-bit system. You would generally need to make the same changes to both files.

Here's an example of how to change certain settings:

  • In Total Commander, click on INSTALL.INF and click the F4 Edit button.
  • Under the section header [auto] change auto=0 into auto=1. This will change the default to automatic installation without prompting the user for any information.
  • Under the section header [Destination] change the line Dir=%TotalcmdDefaultDir% into Dir=c:\Program Files\Total Commander. This will change the default installation folder. The installer will ignore this location if a previous installation is found, unless you also set the option IgnoreOldLocation=1.

Some other things you can do besides changing various default settings are: add more settings to be included in the wincmd.ini file, add more languages, add additional shortcuts to be added to the Windows start menu. If you want to make changes to the INSTALL.CAB file, CAB Create for TC installers may be helpful to you.

Repack the installation data

Once you are done modifying the installation data, you must pack all files into a zip file with compression rate 0 (no compression). An easy way to do this in Total Commander is to create a button for it on the button bar. That way you don't have to change the compression rate in Configuration and change it back later. To add such a button, select and copy the code below, then right-click on an empty space in one of the button bars and click Paste.

TOTALCMD#BAR#DATA
ZipFromList -0
?"%B.zip" %UF
%COMMANDER_PATH%\TOTALCMD64.EXE,21
Pack with zero compression (store)


-1

After you added the button, pack the data file like this:

  • Select all your data files.
  • Click the button Pack with zero compression (store)
  • Click OK to confirm the name.

A zip file is now created with the same name as the folder holding your files, so INSTALL.zip if your folder name was INSTALL.

Create custom installer

Once you created your customized installation data (see #Customize installation data), you need the install.exe program to install the data. There are several options available to you:

  1. Use install.exe to install your packed installation data. (few files needed for installation, easy to update)
  2. Add your packed installation data to the install.exe program. (only 1 file needed for installation, but somewhat harder to create)
  3. Use the legacy install.exe program with unpacked installation data.

Use install.exe

You can download the current install.exe program by downloading sfxhead_installer.zip.

Extract the file sfxhead.sfx and rename it to install.exe. The zip file contains both a 32-bit version and a 64-bit version. Choose the one you want to use. If you use the 64-version you could name the program install64.exe for clarity.

Make sure the program is not blocked by Windows Defender SmartScreen. Unblock if necessary.

The install program is the same program used by the official installers, so the same command line parameters are available. You can also simply use one of the official installers to install your installation data.

Suppose your customized installation data is in the file INSTALL.zip or INSTALL64.zip. To install it, you could create a batch file named install.cmd or install64.cmd. Your batch file could for example look like this:

cd /D %~dp0
install.exe INSTALL.zip

or:

cd /D %~dp0
tcmd1052x64.exe /FKZ"INSTALL64.zip" c:\Program Files\Total Commander

(%~dp0 means drive and path of the batch file)

Add your installation data to install.exe

Suppose your customized installation data is in the file INSTALL.zip. One way to turn this file into a installer program is described here.

  • Copy your Total Commander program folder to a new folder. Name your folder for example Create installer.
  • In this folder, replace the file sfxhead.sfx with the one from sfxhead_installer.zip. The zip file contains both a 32-bit version and a 64-bit version. Choose the one you want to use.
  • Run the Total Commander program in this folder.
  • Navigate to your INSTALL.zip file and rename it to INSTALL.exe (Shift+F6).
  • Total Commander will suggest to create a self extracting zip file. Click Yes.
  • Close Total Commander.

You have now created your custom installer file INSTALL.exe.

Use the legacy install.exe

The legacy installer works with unpacked installation files (skip step 3 in #Customize installation data).

Unpack installer.zip to the folder with your unpacked installation files and you have your installation folder ready to go. Run install.exe or install64.exe to install your custom installation.

See also

External links

  • sfxhead_installer.zip - Total Commander install program.
  • installer.zip - Total Commander legacy install program.
  • CAB Create - A working environment for customizing the INSTALL.CAB file found in Total Commander installers.