靜默安裝

有時我們在安裝程序的時候,希望是靜默安裝的,不顯示下一步下一步,這編訪問來教大家如何來操作,現在常用的製作安裝程序的軟件有,  Microsoft Windows Installer  , Windows 補丁包 , InstallShield  ,  InstallShield with MSI  ,  WISE Installer  , Inno Setup , NullSoft Installation System  等。

軟件的安裝採取全自動或半自動的方式進行。

  一、Microsoft Windows Installer

  如果某個軟件是用 Windows Installer 打包的,那你就應該能在文件夾中看到 *.msi 文件。這是最典型的特徵,這些文件通常可以使用 /QB 和 /QN 參數進行自動安裝。

  /qb 會在窗口中顯示一個基本的安裝進程。
  /qn 參數則不會顯示任何窗口,直接在後臺自動安裝。

  爲了阻止某些程序安裝成功後自動重啓動(例如 Kerio Personal Firewall 4),你可以在 /qn 或者 /qb參數後使用REBOOT=Suppress標記。

  例如:安裝虛擬光驅 DaemonTools:msiexec /i dtools.msi /qb REBOOT=SUPPRESS


  二、Windows 補丁包

  有兩種情況,一種是類似IE增量補丁包的那種安裝文件,要使之靜默安裝,只需要在執行文件後加上 /q:a /r:n 參數即可;一種是 Windows 常用的補丁文件,一般情況下加上 /U /N /Z 即可實現靜默安裝。(對於新的系統補丁,也可使用 /passive /norestart)。這通用大部分情況,但某些特定的補丁不能用此法進行靜默安裝。


  三、InstallShield  
               

  1、要使用靜默安裝的方式安裝用InstallShield技術打包的程序,首先要在現有的操作系統中創建一個setup.iss文件。在命令行窗口中使用 -R 參數(大小寫敏感)運行安裝程序。

  例如:Setup.exe -R

  2、接着會顯示常見的安裝屏幕,並且詢問你一些問題,例如要安裝的目錄等有一點是很重要的,在安裝結束後你不能選擇“立刻重啓動計算機”的選項。如果你選了,在批處理文件中的其他命令就會因爲計算機重啓動而無法執行。

  3、在安裝程序運行完畢後,打開你的 C:\Windows(或者C:\WINNT)目錄,然後找到 setup.iss 文件,把這個文件和你將要靜默安裝的程序 setup.exe 保存在同一個目錄中。

  4、 用以下命令進行靜默安裝:setup.exe -s [-sms]

  說明:怎麼知道哪個程序是使用InstallShield技術打包的?

  大部分這類程序的安裝文件都可以被壓縮軟件解壓縮,安裝文件 setup.exe 的屬性對話框中應該有“InstallShield (R) Setup Launcher”或者其他類似的字樣。

  最後,如果你在保存安裝文件的文件夾中看到了一個 setup.iss 文件,那麼毫無疑問這是用 InstallShield 打包了!


  四、InstallShield with MSI

  InstallShield with MSI 製作的安裝文件,請使用類似:setup.exe /s /v "/qb" 來安裝。


  五、WISE Installer

  用WISE技術打包的軟件在安裝的時候可以選擇使用 /s 參數進行自動安裝。


  六、Inno Setup  

  Inno Setup 製作的安裝文 件,請使用:setup.exe /sp- /silent /norestart

  說明:怎麼知道哪個安裝程序是用Inno 技術打包的?

  這種軟件在安裝時出現的第一個界面,在窗口標題欄左側的圖標上點擊鼠標左鍵,然後再探出菜單上點擊“About Setup”可以看見安裝類型。


  七、NullSoft Installation System  

  使用 NSIS(NullSoft Installation System)製作的安裝文件,可用 /S (注意大寫)來進行靜默安裝(“S”是大小寫敏感的)。

  例如:Setup.exe /S

  也可以用 /D參數選擇將要安裝的目標分區和文件夾:

  例如:Setup.exe /S /D=E:\Software\QQ2007

  像Winamp 和CDex這類的軟件都會在安裝結束後顯示一個確認屏幕(CDex)或者一個設置文件關聯方式的結束安裝屏幕(Winamp)

  說明:怎麼知道哪個程序是使用NSIS技術打包的?

  很多用NSIS打包的程序在安裝的時候都有類似的窗口,例如Winamp 和CDex。


  八、Wise Installation Professional

  製作的安裝文件,可用 /silent 參數進行靜默安裝

無人值守安裝光盤最有魅力的地方之一
就是在安裝過程中可以靜默安裝好預先設計集成的一些常用軟件,安裝結束以後軟件就已經可以使用
但是很多朋友發現每個軟件以及系統補丁,它們的靜默安裝參數是不一樣的
在本文就和廣大愛好者一起研究一下幾種常見軟件封包形式的靜默安裝方式
如有遺漏和錯誤之處,請指出,大家互相交流!

常用的軟件封包形式主要有以下幾個形式
Inno Setup
InstallShield
NSIS
Microsoft Windows Installer
WISE

QUOTE:

一.Inno Setup


使用Inno技術製成的程序安裝包可以使用/SILENT 和 /VERYSILENT參數進行靜默安裝
我不知道這兩個參數有什麼分別,因爲它們實現的功能看上去是一樣的

setup.exe /VERYSILENT

你會看到一個對話框,詢問你是否打算繼續安裝:

我們可以通過使用一個參數跳過這個對話框:

setup.exe /VERYSILENT /SP-

有些利用Inno 技術做作的安裝包會在程序安裝完畢後自動運行所安裝的程序,例如ISOBuster
不過我們可以使用一個叫做Taskkill的系統自帶工具殺死相關的進程。

以下是一個可以用於批處理文件安裝由Inno打包的軟件的命令的示例:

ECHO.
ECHO 正在安裝ISOBuster 1.4
ECHO 請稍候...
start /wait %systemdrive%installApplicationsISOBusterIsoBuster14.exe /VERYSILENT /SP-
ECHO.
ECHO Killing ISOBuster.exe process
taskkill.exe /F /IM isobuster.exe
ECHO.

我怎麼知道哪個安裝程序是用Inno 技術打包的?

這種軟件安裝時第一個界面一般如下圖所示
在窗口標題欄左側的圖標上點擊鼠標左鍵
然後再探出菜單上點擊“About Setup”也可以看見安裝類型

更多使用Inno技術打包的軟件可用的參數可以在下面看到:
E文好的朋友可以仔細研究研究
With the Inno Setup Extentions in use the following command line switches become available:

SP-
Disables the This will install... Do you wish to continue? prompt at the beginning of Setup. Of course, this will have no

effect if the DisableStartupPrompt [Setup] section directive was set to yes.

/SILENT, /VERYSILENT
Instructs Setup to be silent or very silent. When Setup is silent the wizard and the background window are not displayed but

the installation progress window is. When a setup is very silent this installation progress window is not displayed.

Everything else is normal so for example error messages during installation are displayed and the startup prompt is (if you

haven''t disabled it with DisableStartupPrompt or the ''/SP-'' command line option explained above)

If a restart is necessary and the ''/NORESTART'' command isn''t used (see below) and Setup is silent, it will display a

Reboot now? messagebox. If it''s very silent it will reboot without asking.

/NORESTART
Instructs Setup not to reboot even if it''s necessary.
/LOADINF="filename"
Instructs Setup to load the settings from the specified file after having checked the command line. This file can be prepared

using the ''/SAVEINF='' command as explained below.

/SAVEINF="filename"
Instructs Setup to save installation settings to the specified file.

/DIR="x:dirname"
Overrides the default directory name displayed on the Select Destination Directory wizard page. A fully qualified pathname

must be specified. If the [Setup] section directive DisableDirPage was set to yes, this command line parameter is ignored.

/GROUP="folder name"
Overrides the default folder name displayed on the Select Start Menu Folder wizard page. If the [Setup] section directive

DisableProgramGroupPage was set to yes, this command line parameter is ignored.

/NOICONS
Instructs Setup to initially disable the Don''t create any icons check box on the Select Start Menu Folder wizard page.

/COMPONENTS="comma separated list of component names"
Overrides the default components settings. Using this command line parameter causes Setup to automatically select a custom

type.

QUOTE:

二.InstallShield

要使用靜默安裝的方式安裝用InstallShield技術打包的程序
你首先要在現有的操作系統中創建一個setup.iss文件。

1. 在命令行窗口中使用 -R 參數(大小寫敏感)運行安裝程序。

例如:
Setup.exe -R

2. 接着會顯示常見的安裝屏幕,並且詢問你一些問題,例如要安裝的目錄等
有一點是很重要的,在安裝結束後你不能選擇“立刻重啓動計算機”的選項
如果你選了,在批處理文件中的其他命令就會因爲計算機重啓動而無法執行

3. 在安裝程序運行完畢後,打開你的C:Windows (或者C:WINNT)目錄
然後找到setup.iss文件,把這個文件和你將要靜默安裝的程序setup.exe保存在同一個目錄中

4. 用以下命令進行靜默安裝:

start /wait %systemdrive%installApplicationApplication_nameSetup.exe -s

5. 對所有準備進行靜默安裝,並且使用了InstallShield技術打包的程序重複上面的步驟操作

技術難點:從光盤上的RunOnceEx中安裝用Installshield技術打包的程序
如果從光盤上直接執行RunOnceEx,用Installshield打包的應用程序安裝將會失敗
除非你指定了用於保存日至文件的位置
下面就有一個示例,你可以將這個例子用於你自己的程序的安裝(粗體字部分看仔細了):

REG ADD %KEY%% /VE /D "Kerio Personal Firewall 2.1.5" /f
REG ADD %KEY%% /V 1 /D "%CDROM%appsKPFSetup.exe -s -f2"%systemdrive%kerio.log"" /f

然後你可以用一個cleanup.cmd文件刪除kerio.log文件
DEL "%systemroot%kerio.log"

我怎麼知道哪個程序是使用InstallShield技術打包的?
大部分這類程序的安裝文件都可以被壓縮軟件解壓縮,安裝文件setup.exe的屬性對話框中應該有“InstallShield (R) Setup Launcher”或者

其他類似的字樣。
最後,如果你在保存安裝文件的文件夾中看到了一個setup.iss文件,
那麼毫無疑問這是用InstallShield打包了!


QUOTE:

三. Nullsoft SuperPiMP Install System (NSIS)


使用NSIS 打包的安裝文件可以用 /S參數進行自動安裝(“S”是大小寫敏感的):

Setup.exe /S

你也可以用 /D參數選擇將要安裝的目標分區和文件夾:

Setup.exe /S /D=E:SoftwareCDex

像Winamp 和CDex這類的軟件都會在安裝結束後顯示一個確認屏幕(CDex)
或者一個設置文件關聯方式的結束安裝屏幕(Winamp)
我還不知道怎樣跳過這一步,但是這個屏幕對批處理文件的繼續執行不會有任何影響


我怎麼知道哪個程序是使用NSIS技術打包的?


很多用NSIS打包的程序在安裝的時候都有類似這樣的窗口,例如Winamp 和CDex:

 

四.Microsoft Windows Installer


微軟老大的封包形式!
如果某個軟件是用Windows Installer打包的,那你就應該能在文件夾中看到*.msi文件。
這是最典型的特徵
這些文件通常可以使用 /QB和 /QN參數進行自動安裝。
Powertoys使用了 /s /v/qn參數,對於這些軟件,你可以依次嘗試上面提到的參數
看看哪個是有效的。

/qb 會在窗口中顯示一個基本的安裝進程
/qn 參數則不會顯示任何窗口,直接在後臺自動安裝

阻止程序安裝完成後自動重啓動:
爲了阻止某些程序安裝成功後自動重啓動(例如Kerio Personal Firewall 4),你可以在 /qn 或者 /qb參數後使用REBOOT=Suppress標記,例

如:

setup.msi "/qn REBOOT=Suppress"

有些安裝程序使用 /s/v/qn參數進行自動安裝,因此阻止它們重啓動應該用:

setup.exe /s /v"/qn REBOOT=Suppress"

 

五.WISE Installer


用WISE技術打包的軟件在安裝的時候可以選擇使用 /s參數進行自動安裝:

Setup.exe /s

更多的其他參數:
You can run Wise Installation .EXE with command line options to automate many of the tasks you would normally do in the User

Interface. The list of options is as follows.

/c file.wse -- creates executable file from wise script
/r -- opens Wise in SetupCapture window
/u -- runs the upgrade wizard that checks for any upgrades online
/d CompVar=Value -- defines a single compiler variable in Enterprise Edition. Multiple definitions require multiple /d
/d=filename -- uses filename to define compiler variables. Each line in file is CompVar=Value

Example: installbuilder.exe /c /d _MYVAR_="Test" c:mysource ilessetup.wse

Wise Installations:

/T -- test mode
/X pathname -- extracts files into pathname
/Z pathname -- extracts files into pathname and reboots
/S -- silent install
/M -- prompts for windows, system, temp directories
/M=filename -- specifies a value file similar to /d above, but for standard variables (See NOTE below).
/M1 -- same as /m plus it prompts before any file that is self-registered
/M2 -- reserved for internal use by Wise during debugger sessions

Example: setup.exe /T

Unwise:

/Z -- remove empty directories, including one with unwise itself in it.
/A -- automatic mode, no user choices other than cancel.
/S -- silent mode, automatic mode with no user choices
/R -- rollback mode, selects option to rollback on uninstall
/U -- like automatic mode, but gives all choices other than custom/automatic title window title can be at the end of the

command line

Example: unwise.exe /S c:myprogramdirectoryinstall.log

NOTE: The values file is a simple text file with variables listed, one per line, in VARIABLE="VALUE" format. If the variable

is found in the values file, the specified value is used; otherwise, its value is unchanged. The file containing the

variables can be up to 32K.

我怎麼知道哪些程序是使用Wise技術打包的?

使用Wise技術打包的大部分程序都會在開始運行的時候顯示一個啓動界面:
但是也有一些會最小化這個窗口,只顯示一個深藍色的背景,還有安裝窗口在屏幕的中央

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章