思路
NI安裝包的setup.exe 是可以有參數的,例如希望修復安裝LabVIEW時,可以使用 \reinstall 參數,從而覆蓋安裝所有的文件,不需要先進行卸載。參看Force Reinstall NI Software from the Command Prompt in Windows.
批量安裝腳本
根據這個思路,以下腳本可以批量安裝NI軟件。創建 install.bat 腳本文件,其中每行安裝一個NI軟件,格式為:
[軟件安裝包路徑] /qf /AcceptLicenses yes /disableNotificationCheck /r:n
腳本片段如下:
"C:\software\LabVIEW\2012\12.0.0\English\32bit\setup.exe" /qf /AcceptLicenses yes /disableNotificationCheck /r:n
"C:\software\LabVIEW Add-ons\Real-Time\2012\12.0.0\English\setup.exe" /qf /AcceptLicenses yes /disableNotificationCheck /r:n
"C:\software\NI-488.2\3.0\3.0.0\Full\NI4882\setup.exe" /qf /AcceptLicenses yes /disableNotificationCheck /r:n
"C:\software\NI-DCPower\1.7\1.7.5\full\NIDCPWR175\setup.exe" /qf /AcceptLicenses yes /disableNotificationCheck /r:n
"C:\software\NI-DMM\3.0\3.0.6\Full\NIDMM306\setup.exe" /qf /AcceptLicenses yes /disableNotificationCheck /r:n
參數說明:
- /qf: 靜默安裝
- /AcceptLicenses yes:認可NI 的license 聲明
- /disableNotificationCheck: 禁用安裝結束后的 update check
- /r:n: 最后不重啟電腦
注意事項:
- 如果軟件放在服務器上,使用前必須能保證登陸服務器;
- 在Win7及以上windows 操作系統中,使用管理員權限運行該腳本;
- 根據自己的需求刪減腳本安裝的軟件,NI的installer基本全部支持。
- 注意安裝順序。某些NI模塊具有依賴關系,被依賴的軟件模塊需要先被安裝。