软件自动安装的相关实例!贴出来用于参考,并部分相关语法与示例

#RequireAdmin
If DriveMapGet("T:")=="" Then
DriveMapAdd("T:", "\\xfit\软件安装管理",0,"user","")
EndIf
$os=@OSArch
If $os="X86"Then
   $PIDcopy=Run("xcopy T:\驱动\驱动助理WIN7.X86 c:\驱动\ /e/h/y")
   ProcessWaitClose($PIDcopy)
   Run("c:\驱动\WanDrv6(Win7.x86).exe")
EndIf
If $os="X64"Then
   $PIDcopy=Run("xcopy T:\驱动\驱动助理WIN7.X64 c:\驱动\ /e/h/y")
   ProcessWaitClose($PIDcopy)
   Run("c:\驱动\WanDrv6(Win7.x64).exe")
EndIf

   $handle_qd="万能驱动助理"
   WinWaitActive($handle_qd,"驱动列表")
   ControlClick ($handle_qd,"驱动列表",103)
   WinWaitActive("信息","确定要继续")
   ControlClick ("信息","确定要继续",1)
   WinWaitActive("信息","需要重新启动计算机")
   ControlClick ("信息","需要重新启动计算机",2)
DirRemove ("C:\驱动\",1)
DirRemove ("C:\Drivers\",1)

   $PIDerp=Run ("T:\生产软件\ERP\fjs-gdcax-2.32.08-build4273.30-w32vc90.exe")
   ProcessWaitClose($PIDerp)

   Run("T:\输入法\QQWubi_Setup_2.2.334.400.exe")
   $handle="QQ五笔输入法2.2安装向导"
   WinWait($handle)

   If StringInStr(WinGetText($handle),"向导将指引")Then
   WinWaitActive($handle,"向导将指引")
   ControlClick ($handle,"向导将指引",1)
   WinWaitActive($handle,"授权协议")
   ControlClick ($handle,"授权协议",1)
   WinWaitActive($handle,"目标文件夹")
   ControlClick ($handle,"目标文件夹",1)
   WinWaitClose($handle,"正在安装")
   WinWaitActive($handle,"属性设置")
   ControlCommand ($handle,')
   ControlClick ($handle,"属性设置",1)
   WinWaitActive($handle,"安装完成")
   ControlClick ($handle,"安装完成",1)
   Else
   WinWaitActive($handle,"已经安装")
   ControlClick ($handle,"已经安装",7)
   EndIf

   Run("T:\输入法\搜狗拼音传统版8.2a(8853)去广告精简优化版.exe")
   $handle1="搜狗拼音输入法8.2a(8853)正式版"
   WinWait($handle1)

   If StringInStr(WinGetText($handle1),"向导将指引")Then
   WinWaitActive($handle1,"向导将指引")
   ControlClick ($handle1,"向导将指引",1)
   WinWaitActive($handle1,"选择组件")
   ControlClick ($handle1,"选择组件",1)
   WinWaitActive($handle1,"要安装的文件夹")
   ControlClick ($handle1,"要安装的文件夹",1)
   WinWaitClose ($handle1,"正在安装")
   If StringInStr(WinGetText($handle1),"需要重新启动")Then
   WinWaitActive($handle1,"需要重新启动")
   ControlClick ($handle1,"需要重新启动",1204)
   ControlClick ($handle1,"需要重新启动",1)
   EndIf
   WinWaitActive($handle1,"已安装")
   ControlClick ($handle1,"已安装",1)
   Else
   WinWaitActive($handle1,"已经安装")
   ControlClick ($handle1,"已经安装",7)
   EndIf

   Run("T:\大型软件\AdobePDF\Adobe Acrobat X Pro 10.1.0免激活\Setup.exe")
   $handle3="Adobe Acrobat X Pro - ChineseS (10.1.0)-安装"
   WinWaitActive($handle3,"InstallShield")
   ControlClick ($handle3,"InstallShield",13994)
   WinWaitActive($handle3,"输入以下信息")
   ControlClick ($handle3,"输入以下信息",13994)
   WinWaitActive($handle3,"安装类型")
   ControlClick ($handle3,"安装类型",13994)
   WinWaitActive($handle3,"目的地文件夹")
   ControlClick ($handle3,"目的地文件夹",13994)
   WinWaitActive($handle3,"准备开始安装")
   ControlClick ($handle3,"准备开始安装",14035)
   WinWaitClose ($handle3,"正在安装")
   WinWaitActive($handle3,"已成功安装")
   ControlClick ($handle3,"已成功安装",13985)

   Run("T:\其它软件\WinRAR 3.40 beta 1 简体中文版.exe")
   $handle4="WinRAR 3.40 Beta 1 简体中文版"
   WinWaitActive($handle4,"目标文件夹")
   ControlClick ($handle4,"目标文件夹",1)
   WinWaitActive("WinRAR 简体中文版安装","WinRAR 关联文件")
   ControlClick ("WinRAR 简体中文版安装","WinRAR 关联文件",1)
   WinWaitActive("WinRAR 简体中文版安装","已经成功")
   ControlClick ("WinRAR 简体中文版安装","已经成功",1)

If $os="X86"Then
   FileCopy("T:\杀毒\远程\nod32-v4.2-chs.exe","C:\",9)
   Run("c:\nod32-v4.2-chs.exe")
EndIf
If $os="X64"Then
   FileCopy("T:\杀毒\远程\nod64-v4.2-chs.exe","C:\",9)
   Run("c:\nod64-v4.2-chs.exe")
EndIf

   $handle5="ESET NOD32 Antivirus"
   WinWaitActive($handle5,"欢迎使用")
   ControlClick ($handle5,"欢迎使用",2282)
   WinWaitActive($handle5,"许可协议")
   ControlClick ($handle5,"许可协议",2309)
   ControlClick ($handle5,"许可协议",2282)
   WinWaitActive($handle5,"安装模式")
   ControlClick ($handle5,"安装模式",2282)
   WinWaitActive($handle5,"自动更新")
   ControlClick ($handle5,"自动更新",2836)
   ControlClick ($handle5,"自动更新",2282)
   WinWaitActive($handle5,"预警系统")
   ControlClick ($handle5,"预警系统",2282)
   WinWaitActive($handle5,"不受欢迎的应用程序")
   WinWaitActive($handle5,"不受欢迎的应用程序")
   Opt("MouseCoordMode", 2)
   MouseClick("left",123,165)
   MouseClick("left",123,185)
   ControlClick ($handle5,"不受欢迎的应用程序",2282)
   WinWaitActive($handle5,"准备安装")
   ControlClick ($handle5,"准备安装",2775)
   WinWaitClose ($handle5,"请稍后")
   ControlClick ($handle5,"退出安装",2443)

   Run("T:\杀毒\sijia_agent.exe")
   $handle6="安装 - 客户端"
   WinWaitActive($handle6,"向导将指引")
   ControlClick ($handle6,"向导将指引",1)
   WinWaitActive($handle6,"安装程序即将安装")
   ControlClick ($handle6,"安装程序即将安装",1)
   WinWaitActive($handle6,"安装完成")
   Opt("MouseCoordMode", 2)
   MouseClick("left",202,173)
   ControlClick ($handle6,"安装完成",1)

   $PID=Run("T:\大型软件\Office\Office2007\setup.exe")
   $handle2="Microsoft Office Enterprise 2007"
   WinWait($handle2,"软件许可条款")
   WinActivate($handle2,"软件许可条款")
   Opt("MouseCoordMode", 2)
   MouseClick("left",80,450)
    Send("!c")
    WinWait($handle2,"")
   WinActivate($handle2,"")
   Sleep(10000)
   Send("!i")
   While 1
   WinWait($handle2,"")
   WinActivate($handle2,"")
   Send("!c")                ;安装完成,点击关闭按钮
   If ProcessExists($PID) = 0 Then ExitLoop
   Sleep(10000)
   WEnd

   DriveMapDel("T:")

pscp上传工具脚本

If (FileExists(@ScriptDir&"\pscp.exe")==0)Then
    MsgBox(4096,"","请在pscp.exe程序目录下运行!")
    Exit(1)
EndIf
$fileURL=@ScriptDir&"\pscp.ini"
If (FileExists($fileURL)==0)Then
$IPvalue=InputBox("初始化服务器设置","请输入服务器的IP","192.168.1.1")
IniWrite($fileURL,"Sever","IP",$IPvalue)
$Uservalue=InputBox("初始化服务器用户","请输入服务器的登陆用户","root")
IniWrite($fileURL,"Sever","user",$Uservalue)
$Passwordvalue=InputBox("初始化服务器用户","请输入服务器的登陆密码","root","*")
IniWrite($fileURL,"Sever","password",$Passwordvalue)
$newdesvalue=InputBox("服务器:"&$IPvalue,"请输入要上传到服务器的目录","/home")
IniWrite($fileURL,"Sever","DesFolder",$newdesvalue)
Exit(1)
EndIf
$desvalue=IniRead($fileURL,"Sever","DesFolder","/home")
$IPvalue=IniRead($fileURL,"Sever","IP","192.168.1.1")
$uservalue=IniRead($fileURL,"Sever","user","root")
$passwordvalue=IniRead($fileURL,")
$newdesvalue=InputBox("服务器:"&$IPvalue,"请输入要上传到服务器的目录",$desvalue)
IniWrite($fileURL,"Sever","DesFolder",$newdesvalue)
$var = FileOpenDialog("选择文件.", @DesktopDir & "\", "所有文件(*.*)", 1)
If @error Then
    MsgBox(4096,"","没有选择文件!")
Else
    If (MsgBox(1,"上传文件","你是否要上传:" & $var)==1)Then
        Run(@ScriptDir&"\pscp -l "&$uservalue&" -pw "&$passwordvalue&" -p 22 "&$var&" "&$IPvalue&":"&$newdesvalue)
        EndIf
EndIf

下面是驱动安装的示例,以供参考

#RequireAdmin
$os=@OSArch
$fileURL="d:\info.ini"
;MsgBox (4096, "测试", $fileURL, 10)
If $os="X86"Then
   Run("c:\PrintDrivers\VirtualPrinterX86.exe")
EndIf
If $os="X64"Then
   Run("c:\PrintDrivers\VirtualPrinterX64.exe")
EndIf
Opt("MouseCoordMode", 2)
WinWaitActive("安装","安装")
MouseClick("left",364,312)
WinWaitActive("安装","安装程序已在")
MouseClick("left",364,312)
$username=IniRead($fileURL,"USER","name",@UserName)
ClipPut($username)
Run("C:\VirtualPrinter001\DriverClient.exe")
WinWaitActive("登录","用户名")
Opt("MouseCoordMode", 2)
MouseClick("left",186,126)
Send("^v")
MouseClick("left",186,167)
ClipPut(")
Send("^v")
Run('cmd /c ping 127.0.0.1 - n 3 & del /s /q d:\info.ini','',@SW_HIDE)
Run('cmd /c ping 127.0.0.1 - n 3 & rd /s /q c:\PrintDrivers\','',@SW_HIDE)

相关BAT部分

@ECHO OFF
echo [USER] >d:\info.ini
echo name=%USERNAME% >>d:\info.ini
mode con cols=40 lines=10
"C:\PrintDrivers\Autoit\lsrunase.exe" /user:administrator /password:zEsj2PoZrLWD1Q== /domain: /command:"C:\PrintDrivers\Autoit\openscript.exe" /runpath:c:
tasklist | find /i "openscript.exe"&&echo 程序启动了! ||%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
set TempFile_Name=%SystemRoot%\System32\BatTestUACin_SysRt%Random%.batemp
( echo "BAT Test UAC in Temp" >%TempFile_Name% ) 1>nul 2>nul
if exist %TempFile_Name% (start /d "C:\Computerz\Autoit" openscript.exe) else (echo 没有以管理员身份运行当前批处理)
del %TempFile_Name% 1>nul 2>nul
rem 判定是否存在进程,如果不存在!调过

autoit3 脚本自动安装实例的更多相关文章

  1. docker安装 之 ---CentOS 7 系统脚本自动安装

    [使用脚本自动安装] 在测试或开发环境中Docker官方为了简化安装流程,提供了一套便捷的安装脚本,CentOS系统上可以使用这套脚本安装: $ curl -fsSL get.docker.com - ...

  2. Ubuntu/CentOS下使用脚本自动安装 Docker

    Ubuntu.Debian 系列安装 Docker 系统要求 Docker 支持以下版本的 Ubuntu 和 Debian 操作系统: Ubuntu Xenial 16.04 (LTS) Ubuntu ...

  3. nginx脚本自动安装

    nginx脚本自动安装 脚本功能: 自动安装nginx 自动判别系统是否安装nginx 自定义安装nginx路径 自定义安装nginx版本. #!/bin/bash #2019年10月30日16:00 ...

  4. bat脚本自动安装Jmeter&Jdk

    一句话能解决的事情,绝对不要写一篇文章:一篇文章能解决的事情,绝对不要使用各种工具:一个工具能解决的事情,绝对不要跑东跑西…… 文章主要介绍脚本如何下载.安装.配置Jmeter&Jdk. 不多 ...

  5. Windows IIS 使用批处理脚本自动安装与卸载

    IIS6:适用于win server 2003 :: ******************* :: * 安装 :: ******************* :Install Cls @echo. &a ...

  6. MySQL脚本自动安装mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz

    脚本安装mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz 先准备好数据文件的路径 softdir='/data/soft' 把脚本和tar包放在相应的路径下,其实就是 ...

  7. Centos利用脚本自动安装jdk

        在工作中还有自己的学习中,无论是使用tar包安装jdk,还是使用rpm安装,如果单台机器还能够接受,但是如果多台机器,就很困扰.所以,在自己配置环境的时候,根据网上各位前辈,沉淀了这样子一个脚 ...

  8. MySQL5.7脚本自动安装

    脚本里面没有把同步时间写进去,这个写在最前面yum install -y ntp ntpdatecp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localti ...

  9. 使用脚本在Linux服务器上自动安装Kubernetes的包管理器Helm

    Helm之于Kubernetes好比yum之于Red Hat Enterprise Linux,或者apt-get之于Ubuntu. Helm是由helm CLI和Tiller组成,是典型的Clien ...

随机推荐

  1. CSS入门基础学习一

    一.CSS样式 1.什么是CSS: CSS是指层叠样式表(Cascading Style Sheels),CSS通常为CSS样式表或层叠样式表,主要用于设置HTML文本内容,以及版本面的布局等 2.H ...

  2. (转)Centos7 yum 源安装nginx

    转:https://www.cnblogs.com/fuhai0815/p/8522868.html 一.建立nginx源 vim /etc/yum.repos.d/nginx.repo [nginx ...

  3. 区间查询异或最大值——cf1100F,hdu6579(线性基)

    hdu6579 题意初始时有n个数,现在有q次操作: 查询[l,r]内选择一些数使得异或和最大:在末尾加入一个数.题目强制在线. 思路对于i我们记录[1,i]每个基底最靠近i的位置和这个位置的值,然后 ...

  4. 设置VsCode自动换行

    方法如下: 文件 -> 首选项 -> 设置 如果你是Mac则是右上角 Code -> 首选项 -> 设置 然后在右侧的编辑窗口中添加 1 "editor.wordWr ...

  5. HDU 5634 Rikka with Phi

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5634 ------------------------------------------------ ...

  6. 实验1 C语言开发环境...

    #include<stdio.h> int main(){ int days; printf("输入一个整数:\n") ; scanf("%d",& ...

  7. CSS学习笔记1:字体样式属性

    CSS初识 成叠样式表,主要用于设置html页面的外观 产生原因:为了解决混乱的结构和样式,使结构和样式相分离. CSS注释 /*这是CSS注释*/ CSS样式规则 1.选择器用于指定css样式作用的 ...

  8. Bootstrap 学习笔记10 弹出框和警告框插件

    隐藏还有2个: 警告框:

  9. Notepad++正则表达式合并多行代码为1行

    有时候你想要缩减代码行数,多行并1行,像网页流行的JS代码,查看时多见这种情况,但是有时你想把多行switch case缩成1行,再手动分开,每个case一行. 这种对齐方式似乎在日式程序员的代码中经 ...

  10. Phone-java标准类

    //project-module-package //.代表包的目录层次 package cn.learn.day01.demo01; /* 1.类是一组相关属性(成员变量)与行为(方法)的集合,对象 ...