zoukankan      html  css  js  c++  java
  • 批处理实现软件静默批量安装

    参考:以下链接不分先后

    http://www.cnblogs.com/toor/p/4198061.html

    http://www.autoitx.com/viewthread.php?tid=31956&extra=&page=1

    http://m.blog.csdn.net/article/details?id=8348301

    http://wangpai.2345.cn/thread.php?fid=12&pid=3830327

    https://www.idiannaomi.com/thread-5053-1-1.html

    http://blog.csdn.net/zhaobangyu/article/details/18406957

    -------------------------------------------------------------------------------------------------------------------------

    这一阵子在学校机房弄电脑,遇到批量装软件的问题,想到了Windows的批处理。

    我是这么做的每个需要安装的软件分别放到各自文件夹内,每个文件夹里有一个批处理脚本可以静默安装目录里的软件,最后在所有要安装的软件文件夹外再写一个调用它们的批处理脚本。这样,既实现了单独安装的需求,也实现了批量安装的需要。(PS:不是所有软件都能用批处理安装,不行可以尝试AU3)

     7zip(脚本保存为install_7zip.bat):

     1 @echo off
     2 title 自动安装7zip ----by yllinux 博客:http://www.cnblogs.com/yllinux/
     3 color 3f
     4 echo                        正在安装7zip 
     5 echo.
     6 echo.
     7 echo                 请不要关闭此窗口,耐心等待!!!
     8 start /wait /min 7zip.exe /S /D=D:software7zip
     9 echo.
    10 echo.
    11 echo                       已成功安装7zip 
    静默安装7zip

    acrobat_xi_pro(脚本保存为install_acrobat_xi_pro.bat):先解压安装包得到MSI。

     1 @echo off
     2 title 自动安装acrobat_xi_pro ----by yllinux 博客:http://www.cnblogs.com/yllinux/
     3 color 2f
     4 echo                        正在安装acrobat_xi_pro 
     5 echo.
     6 echo.
     7 echo                 请不要关闭此窗口,耐心等待!!!
     8 start /wait /min msiexec.exe /i AcroPro.msi /quiet /norestart INSTALLDIR="D:softwareacrobat_xi_pro"
     9 echo.
    10 echo.
    11 echo                       已成功安装acrobat_xi_pro
    静默安装acrobat_xi_pro

    notepad++(脚本保存为install_notepad++.bat):

     1 @echo off
     2 title 自动安装notepad++ ----by yllinux 博客:http://www.cnblogs.com/yllinux/
     3 color 5f
     4 echo                        正在安装notepad++ 
     5 echo.
     6 echo.
     7 echo                 请不要关闭此窗口,耐心等待!!!
     8 start /wait /min notepad++.exe /S /D=D:software
    otepad++
     9 echo.
    10 echo.
    11 echo                       已成功安装notepad++
    静默安装notepad++

    office2007(脚本保存为install_office2007.bat):先在控制台里运行start /wait /admin 弹出office2007配置窗口,一定得配置秘钥和显示级别为“无”,其它安装位置、安装组件等等根据需求填。最后另存为 office2007_config.MSP

     1 @echo off
     2 title 自动安装office2007 ----by yllinux 博客:http://www.cnblogs.com/yllinux/
     3 color 3f
     4 echo                        正在安装office2007
     5 echo.
     6 echo.
     7 echo                 请不要关闭此窗口,耐心等待!!!
     8 start /wait /min setup.exe /adminfile office2007_config.MSP
     9 echo.
    10 echo.
    11 echo                       已成功安装office2007
    静默安装office2007

    potplayer(脚本保存为install_potplayer.bat):

     1 @echo off
     2 title 自动安装potplayer ----by yllinux 博客:http://www.cnblogs.com/yllinux/
     3 color 1f
     4 echo                        正在安装potplayer 
     5 echo.
     6 echo.
     7 echo                 请不要关闭此窗口,耐心等待!!!
     8 start /wait /min potplayer.exe /S /D=D:softwarepotplayer
     9 ::关闭IE弹窗
    10 taskkill /im iexplore.exe /f
    11 echo.
    12 echo.
    13 echo                       已成功安装potplayer
    静默安装potplayer

    sogou_input(脚本保存为install_sogou_input.bat):

     1 @echo off
     2 title 自动安装sogou_input ----by yllinux 博客:http://www.cnblogs.com/yllinux/
     3 color 2f
     4 echo                        正在安装sogou_input
     5 echo.
     6 echo.
     7 echo                 请不要关闭此窗口,耐心等待!!!
     8 start /wait /min sogou_input.exe /S /D=D:softwaresogou_input
     9 echo.
    10 echo.
    11 echo                       已成功安装sogou_input
    静默安装sogou_input

    thunder_9(脚本保存为install_thunder_9.bat):

     1 @echo off
     2 title 自动安装Thunder_9 ----by yllinux 博客:http://www.cnblogs.com/yllinux/
     3 color 1f
     4 echo                        正在安装Thunder_9 
     5 echo.
     6 echo.
     7 echo                 请不要关闭此窗口,耐心等待!!!
     8 start /wait /min Thunder_9.exe /S /D=D:softwareThunder_9
     9 echo.
    10 echo.
    11 echo                       已成功安装Thunder_9
    静默安装thunder_9

    ultraiso(脚本保存为shortcut_ultraiso.bat):此为绿化软件,无需安装,先拷贝到指定位置再发送快捷方式到桌面

     1 @echo off
     2 title 自动添加快捷方式ultraiso ----by yllinux 博客:http://www.cnblogs.com/yllinux/
     3 color 0f
     4 ::改下面三行
     5 xcopy %cd% D:softwareultraiso /e /h
     6 set Program=D:softwareultraisoUltraISO.exe
     7 set LnkName=UltraISO
     8 
     9 set WorkDir=
    10 if not defined WorkDir call:GetWorkDir "%Program%"
    11 (echo Set WshShell=CreateObject("WScript.Shell"^)
    12 echo strDesKtop=WshShell.SpecialFolders("DesKtop"^)
    13 echo Set oShellLink=WshShell.CreateShortcut(strDesKtop^&"\%LnkName%.lnk"^)
    14 echo oShellLink.TargetPath="%Program%"
    15 echo oShellLink.WorkingDirectory="%WorkDir%"
    16 echo oShellLink.WindowStyle=1
    17 echo oShellLink.Description="%Desc%"
    18 echo oShellLink.Save)>makelnk.vbs
    19 echo 桌面快捷方式创建成功!
    20 makelnk.vbs
    21 del /f /q makelnk.vbs
    添加快捷方式ultraiso

    批量批处理脚本(保存为install_all.bat):双击运行只有一个控制台窗口,不要关闭控制台窗口,否则安装退出。(当然也可以把所有分开的脚本写到一个脚本里而不调用)

     1 cd .7zip
     2 call install_7zip.bat
     3 cd ..
     4 
     5 cd .
    otepad++
     6 call install_notepad++.bat
     7 cd ..
     8 
     9 cd .potplayer
    10 call install_potplayer.bat
    11 cd ..
    12 
    13 cd .Thunder_9
    14 call install_thunder_9.bat
    15 cd ..
    16 
    17 cd .acrobat_xi_pro
    18 call install_acrobat_xi_pro.bat
    19 cd ..
    20 
    21 cd .sogou_input
    22 call install_sogou_input.bat
    23 cd ..
    24 
    25 cd .ultraiso
    26 call shortcut_ultraiso.bat
    27 cd ..
    28 
    29 cd .office2007
    30 call install_office2007.bat
    31 cd ..
    install_all

    完全静默VBS脚本(保存为.vbs文件即可):双击运行什么都不会弹出来,自动安装

    1 Set install = CreateObject("WScript.Shell")
    2 install.Run "install_all.bat",0, True
    VBScript

    ------------------------------------------------------------------------------------------------------------

    想要知道软件的静默安装参数,在控制台里运行:

    [安装包名称] /?      -----如 setup.exe /?

    PS:尽量用官方安装包,被处理过的往往静默参数可能就没了或者变了

    ------------------------------------------------------------------------------------------------------------

    不知道批处理关键字作用,在控制台里运行:

    help [批处理关键字] ----显示关键字的解释帮助,如 help color

    [批处理关键字] /?    ----显示关键字的解释帮助,如 color /?

    ------------------------------------------------------------------------------------------------------------

    如有错误还请指出,如有侵权还请告知,如需转载请注明出处!                                              

    本人博客:http://www.cnblogs.com/yllinux/

  • 相关阅读:
    Android 3.0 r1 API中文文档(108) —— ExpandableListAdapter
    Android 3.0 r1 API中文文档(113) ——SlidingDrawer
    Android 3.0 r1 API中文文档(105) —— ViewParent
    Android 中文 API (102)—— CursorAdapter
    Android开发者指南(4) —— Application Fundamentals
    Android开发者指南(1) —— Android Debug Bridge(adb)
    Android中文API(115)——AudioFormat
    Android中文API(116)——TableLayout
    Android开发者指南(3) —— Other Tools
    Android中文API (110) —— CursorTreeAdapter
  • 原文地址:https://www.cnblogs.com/yllinux/p/6935333.html
Copyright © 2011-2022 走看看