卸载的同时删除日志,卸载的时候判断程序是否正在运行,regsvr32

1.卸载程序的时候如何判断程序是否正在运行

http://bbs.csdn.net/topics/370097914

2.强制删除安装目录

http://blog.csdn.net/cnbata/article/details/6289031

3.注册以及注销ocx控件

http://blog.csdn.net/orion_04/article/details/1676976

http://www.jrsoftware.org/ishelp/index.php?topic=isxfunc_registerserver

Flags:

restartreplace

When an existing file needs to be replaced, and it is in use (locked) by another running process, Setup will by default display an error message.

This flag tells Setup to instead register the file to be replaced the next time the system is restarted (by calling MoveFileEx or by creating an entry in WININIT.INI).

When this happens, the user will be prompted to restart their computer at the end of the installation process.

NOTE: This flag has no effect if the user does not have administrative privileges.

Therefore, when using this flag, it is recommended that you leave the PrivilegesRequired [Setup] section directive at the default setting of admin.

regserver

Register the DLL/OCX file.

With this flag set, Setup will call the DllRegisterServer function exported by the DLL/OCX file, and the uninstaller will call DllUnregisterServer prior to removing the file.

When used in combination with sharedfile, the DLL/OCX file will only be unregistered when the reference count reaches zero.

On a 64-bit mode install, the file is assumed to be a 64-bit image and will be registered inside a 64-bit process.

You can override this by specifying the 32bit flag.

See the Remarks at the bottom of this topic for more information.

安装前卸载之前的版本

http://stackoverflow.com/questions/2000296/innosetup-how-to-automatically-uninstall-previous-installed-version

I have used the following. I'm not sure it's the simplest way to do it but it works.

This uses {#emit SetupSetting("AppId")} which relies on the Inno Setup Preprocessor. If you don't use that, cut-and-paste your App ID in directly.

下面的代码,是Pascal Script

/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end; /////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end; /////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
// Return Values:
// - uninstall string is empty
// - error executing the UnInstallString
// - successfully executed the UnInstallString // default return value
Result := ; // get the uninstall string of the old app
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result :=
else
Result := ;
end else
Result := ;
end; /////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
UnInstallOldVersion();
end;
end;
end;

彻底卸载

http://www.jrsoftware.org/ishelp/index.php?topic=runsection

贴吧里看到的,如何卸载干净http://tieba.baidu.com/p/3252185393

[UninstallRun]
Filename: "{cmd}"; Parameters: "/c rd /s /q ""{app}"""; Flags: hidewizard runhidden

Filename (Required)
The program to execute, or file/folder to open.

If Filename is not an executable (.exe or .com) or batch file (.bat or .cmd), you must use the shellexec flag on the entry. This parameter can include constants.

Parameters
Optional command line parameters for the program, which can include constants.

hidewizard
If this flag is specified, the wizard will be hidden while the program is running.

runhidden
If this flag is specified, it will launch the program in a hidden window. Never use this flag when executing a program that may prompt for user input.

cmd /c 
/C Carries out the command specified by the string and then terminates.

rd命令
命令说明:rd命令只有2个参数,分别是/s和/q。
/s参数的作用是除目录本身外,还将删除指定目录下的所有子目录和文件。用于删除目录树。如果不带这个参数就只能删除空文件夹。
/q参数的作用是安静模式,带/s删除目录树时不需要确认。

[UninstallDelete]
Name: {app}; Type: filesandordirs

Name  (Required)

Name of the file or directory to delete.

NOTE: Don't be tempted to use a wildcard here to delete all files in the {app} directory. Doing this is strongly recommend against for two reasons.

First, users usually don't appreciate having their data files they put in the application directory deleted without warning (they might only be uninstalling it because they want to move it to a different drive, for example). It's better to leave it up to the end users to manually remove them if they want.

Also, if the user happened to install the program in the wrong directory by mistake (for example, C:\WINDOWS) and then went to uninstall it there could be disastrous consequences. So again, DON'T DO THIS!

Type  (Required)

filesandordirs

Functions the same as files except it matches directory names also, and any directories matching the name are deleted including all files and subdirectories in them.

OnlyBelowVersion

http://www.jrsoftware.org/ishelp/index.php?topic=setup_onlybelowversion

Format:  major.minor

Default value:0

Description:

This directive lets you specify a minimum version of Windows that your software will not run on. Specifying "0" means there is no upper version limit. Build numbers and/or service pack levels may be included.

This directive is essentially the opposite of MinVersion.

For compatibility with previous versions of Inno Setup, separate Windows 95/98/Me and Windows NT version numbers may be specified, separated by a comma. Example: OnlyBelowVersion=0,6.0. The Windows 95/98/Me version number (the first number) isn't used, however, as Inno Setup no longer supports Windows 95/98/Me.

Windows Versions

http://www.jrsoftware.org/ishelp/index.php?topic=winvernotes

5.0.2195 Windows 2000
5.1.2600 Windows XP
or Windows XP 64-Bit Edition Version 2002 (Itanium)
5.2.3790 Windows Server 2003
or Windows XP x64 Edition (AMD64/EM64T)
or Windows XP 64-Bit Edition Version 2003 (Itanium)
6.0.6000 Windows Vista
6.0.6001 Windows Vista with Service Pack 1
or Windows Server 2008
6.1.7600 Windows 7
or Windows Server 2008 R2
6.1.7601 Windows 7 with Service Pack 1
or Windows Server 2008 R2 with Service Pack 1
6.2.9200 Windows 8
or Windows Server 2012
6.3.9200 Windows 8.1
or Windows Server 2012 R2
6.3.9600 Windows 8.1 with Update 1
10.0.10240 Windows 10

Note that there is normally no need to specify the build numbers (i.e., you may simply use "6.2" for Windows 8).

Innosetup的更多相关文章

  1. 模块化InnoSetup依赖项安装

    原文在这里:http://www.codeproject.com/Articles/20868/NET-Framework-Installer-for-InnoSetup 源文件地址:http://w ...

  2. innosetup安装之前关闭进程

    InnoSetup覆盖安装的时候可能会因为源程序正在运行而安装失败,以下脚本能够关闭原运行进程. [code] // 安装前检查关闭**进程 function InitializeSetup():Bo ...

  3. 译:用InnoSetup模块化安装依赖项

    译文出处:http://www.codeproject.com/Articles/20868/NET-Framework-Installer-for-InnoSetup 源文件下载:http://fi ...

  4. 【模板下载】innosetup 制作.net安装包的模板

    NetworkComms网络通信框架序言 这个模板是在博客园和CodeProject上的代码修改而成的,感谢原作者 模板是2个 innosetup 制作.net 2.0 安装包的模板 innosetu ...

  5. Innosetup中将bat文件压缩到压缩包中

      有时候在安装的过程中需要调用某些文件(bat或者exe等文件),但是只需要使用一次,然后就可以删掉该文件, 在Innosetup中应该这样操作: 1.在.iss脚本的[Files]章节写下: So ...

  6. InnoSetup打包exe安装应用程序,并添加卸载图标 转

    http://blog.csdn.net/guoquanyou/article/details/7445773 InnoSetup真是一个非常棒的工具.给我的印象就是非常的精干.所以,该工具已经一步步 ...

  7. Innosetup打包自动下载.net framework 动态库及替换卸载程序图标.

    在使用了一段时间微软自带的安装包打包工具后,总感觉不太顺利,于是便想着找一种更简单稳定的打包工具,这类工具其实还不少,最终经过各种考量,我们选择了 InnoSetup , 该工具是一个完全免费的Win ...

  8. InnoSetup中枚举出INI文件的所有sections和键值

    原文 http://blog.chinaunix.net/uid-23480430-id-3016899.html InnoSetup支持一些INI文件操作函数, 例如GetIniString,Ini ...

  9. InnoSetup XML操作函数

    用于InnoSetup 5 以上.对XML文件的操作,简化InnoSetup XML访问过程. 1. [代码]InnoSetup 5 脚本     { ======================== ...

  10. bat文件自动编译InnoSetup脚本

    今天想制作一个bat文件,打包多个innosetup脚本,参考链接:http://www.cnblogs.com/joean/p/4870428.html 流程: 新建文本文档,将.txt改为.bat ...

随机推荐

  1. 工具-WIN7-内存占用过高解决办法

    我的WIN7内存竟然吃到了7.6G,太不可思意了 第一步 看看网上的解决办法 http://jingyan.baidu.com/article/870c6fc31060eab03fe4beee.htm ...

  2. 基于One-Class的矩阵分解方法

    在矩阵分解中. 有类问题比較常见,即矩阵的元素仅仅有0和1. 相应实际应用中的场景是:用户对新闻的点击情况,对某些物品的购买情况等. 基于graphchi里面的矩阵分解结果不太理想.调研了下相关的文献 ...

  3. kentico api

    http://devnet.kentico.com/docs/10_0/api/html/R_Project_Kentico_API.htm ScriptHelper.RegisterClientSc ...

  4. iOS定义静态变量、静态常量、全局变量

    静态变量 当我们希望一个变量的作用域不仅仅是作用域某个类的某个对象,而是作用域整个类的时候,这时候就可以使用静态变量. staticstatic修饰的变量,是一个私有的全局变量.C或者Java中sta ...

  5. 高斯滤波及高斯卷积核C++实现

    高斯滤波是一种线性平滑滤波,适用于消除高斯噪声,在图像处理的降噪.平滑中应用较多,特别是对抑制或消除服从正态分布的噪声非常有效. 高斯滤波的过程其实就是对整幅图像进行加权平均操作的过程.滤波后图像上每 ...

  6. 那些年尝试过的效率工具之Total Commander

    昨天电脑文件很乱,想整理一下发现移动.复制文件要来回目录切换很麻烦,突然就又想起了用Total Commander——简称TC,很久之前尝试过但没坚持使用的工具. 借此机会总结一下自己对TC的认识,后 ...

  7. [luogu P4197] Peaks 解题报告(在线:kruskal重构树+主席树 离线:主席树+线段树合并)

    题目链接: https://www.luogu.org/problemnew/show/P4197 题目: 在Bytemountains有N座山峰,每座山峰有他的高度$h_i$.有些山峰之间有双向道路 ...

  8. 8年js总结

    http://www.cnblogs.com/tylerdonet/p/5543813.html

  9. CentOS 6.9 CentOS 7.4 自动安装系统 kickstart

    通过ks文件 实现 CentOS 6.9 & 7.4 自动安装系统 环境: VMware 14.0 Pro版 光盘镜像: CentOS-6.9-x86_64-minimal.iso ks文件生 ...

  10. React中的事件处理为什么要bind this?

    个人总结: 问: 请给我讲一下React中的事件处理为什么要bind this? 答: 好的,比如说我写了一个类组件,有个onClick属性 ,onClick={ this.fun },如果不bind ...