I downloaded Cream (for Vim). Cream is a free, easy-to-use configuration of the famous Vim text editor for Microsoft Windows, GNU/Linux, and FreeBSD. I downloaded it rather than Vim from the website of the developer, Bram Moolenaar, since I had read the version from the developer's site doesn't support a silent installation, i.e. one where the user does not have to answer any questions or click on any buttons to complete the installation. I wanted to be able perform a silent install using WPKG, a software deployment tool.
THe WPKG page for Vim, noted that the Windows installer from vim.org doesn't have a silent installer, bu the installer created by Steve Hall, which is the one I downloaded from the sourceforge.net site does have one. The author of the WPKG webpage for Vim also noted that Steve's Vim installers from 7.0.146 onwards work correctly for silent installs; however, silent uninstalls still do not work correctly.
The WPKG webpage author created the following removal batch file:
@echo off
if exist "C:\Program Files\vim\vim70\uninstall.exe" %comspec% /c start "Vim" /wait /d %WINDIR% "C:\program files\vim\vim70\uninstall.exe" /S
exit 0
His batch file presumed that Vim would be installed in
C:\program files\vim
. I wanted to specify a different
directory for the installation directory, so I created a batch file
that will check the
Windows registry for the location where Vim is installed and then
uninstall the software based on the location found for it under the
UninstallString
for Vim in the registry.
@echo off
REM The following example shows a "reg query" command that could be issued
REM from the command line to determine the value of "UninstallString" for
REM the Vim editor software. The last line of output contains the "value name",
REM "value type", and "value data", which is the part of the output of
REM interest.
REM C:\>reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Vim /v UninstallString
REM
REM HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Vim
REM UninstallString REG_SZ C:\Program Files\vim\vim72\uninstall.exe
REM Set the variable _UninstallString_Query to the reg query command to be
REM issued.
set _UninstallString_Query=reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Vim /v UninstallString
REM There are two parts at the beginning of the line, the "value name" and
REM the "value type" that aren't relevant. By specifying "2*" the "value name"
REM is ignored, the "value type" goes into %%A and %%B holds everything else
REM on the line.
FOR /f "tokens=2*" %%A IN ('%_UninstallString_Query%') Do set _Uninstall_program=%%B
%comspec% /c start "Vim" /wait /d %WINDIR% "%_uninstall_program%" /S
exit 0
The installation file, gvim-7-2-320.exe
was built with the
Nullsoft Scriptable Install
System (NSIS) as I could see by analyzing the file with
FileAlyzer and
searching for text in the binary file and also when I tried running the
file without the /S
option for a silent install. When I ran
the file without the /S
option, I saw "Nullsoft Install System
v2.45" displayed on one of the installation windows.
An installation package created with NSIS should accept a
/D=dir
parameter to allow one to specify the
installation directory, but no matter what I tried the software always
installed in the default location of C:\Program Files\vim
. I
did put the option at the end of the installation line and used a capital
"D" for the parameter, since the parameters are case sensitive. For the WPKG
install line I first tried the following:
<install cmd='%SOFTWARE%\Editors\gvim-7-2-320.exe /S' /D=%PROGRAMFILES%\Editors\vim/>
That didn't work. the WPKG webpage for NSIS stated
"It must be the last parameter used in the command line and must not contain
any quotes, even if the path contains spaces. Only absolute paths are
supported." So I tried the following variations in place of the environment
variable %PROGRAMFILES%
, but the results were always the same.
\Program Files\Editors\vim
C:\Program Files\Editors\vim
C:\Progra~1\Editors\vim
\Progra~1\Editors\vim
I.e. Vim was installed in C:\Program Files\vim
no matter what
I used. I thought that perhaps I had to use the 8.3 form for directores
with a space in them, but using Progra~1
for Program Files
did not help. It didn't matter that the directory Editors
already existed, i.e. that I wasn't expecting it to create multiple
directory levels. I finally just left it in that location.
The package file I used with WPKG for gvim, gvim.xml
contains
the following lines:
<?xml version="1.0" encoding="UTF-8"?>
<packages>
<package id="gvim" name="gvim" revision="1" reboot="false" priority="0">
<check type="uninstall" condition="exists" path="Vim 7.2.320" />
<!-- Though it uses the NSIS installer, the program won't accept
the /D=dir option that allows you to specify the installation
directory. It insists on installing itself in C:\Program Files\vim. -->
<install cmd='%SOFTWARE%\Editors\gvim-7-2-320.exe /S' />
<upgrade cmd='%SOFTWARE%\Editors\vim-remove.bat' />
<upgrade cmd='%SOFTWARE%\Editors\gvim-7-2-320.exe /S' />
<remove cmd='%SOFTWARE%\Editors\vim-remove.bat' />
</package>
</packages>