首页 > 代码库 > 批处理自动配置Outlook账户
批处理自动配置Outlook账户
公司新员工入职需要逐个配置Outlook客户端,并且修改收发时间,设置签名,繁琐枯燥,Office自定义工具只支持批量增加账户,不能实现该功能,outlook.exe命令行接口也不提供此功能,所以使用批处理+VBS脚本自动完成,程序大致思路:
映射共享服务器,复制邮件签名模板到桌面。
程序支持选择Outlook 2010、2013的32位版本,64位版本需要修改Outlook路径。
由用户输入用户名、密码,回车后程序自动配置,不需要人工操作。
生成vbs脚本并自动运行,完成新建账户
自动设置收发时间为1分钟
自动新建邮件签名,并弹出窗口,提示用户修改签名模板后粘贴即可。
删除vbs自身。
参考资料:http://bbs.winos.cn/thread-42110-1-1.html
代码如下:
@echo off color 0A mode con cols=80 lines=30 echo Outlook 客户端自动配置程序 echo. echo 退出360等安全软件后,请根据本程序提示,输入您的用户名和密码后回车,等待程序自动配置完成,直到出现“配置完成”提示,过程中出现的窗口不需要您手动输入用户名和密码,程序会自动输入,完成后会自动打开Outlook客户端,中间步骤不需要您操作。根据电脑配置不同,配置时间可能较长,请您耐心等待。 echo. echo 请注意:本程序只支持32位Office。 echo. echo. rem 清空本地共享连接 net use * /del /y>nul 2>nul rem 映射共享目录到本机X盘 net use x: \\共享服务器IP\共享文件夹 "密码" /user:"用户名">nul 2>nul rem 复制共享中的《邮件签名模板.docx》到本地 copy x:\邮件签名模板.docx 邮件签名模板.docx>nul 2>nul rem 删除本地映射 net use x: /del /y>nul 2>nul echo. :menu echo 1.Office 2010 echo 2.Office 2013 echo 3.退出程序 echo. echo 请选择您的Office版本: :input set /p ver= if "%ver%"=="1" goto office2010 if "%ver%"=="2" goto office2013 if "%ver%"=="3" goto quit echo 输入错误,请重新输入 goto input :office2010 echo 请输入您的邮箱用户名(例如hello3389): set /p mailname= echo. echo 请输入您的邮箱密码: set /p mailpassword= rem 生成vbs文件 echo set xnet = createobject("wscript.network")>mail.vbs echo Dim strPrgpth>>mail.vbs echo strPrgpth ="C:\Program Files (x86)\Microsoft Office\Office14\Outlook.exe">>mail.vbs echo Set wshshell=CreateObject("wscript.shell")>>mail.vbs echo Set oexec=wshshell.Exec(strPrgpth)>>mail.vbs echo WScript.Sleep 20000>>mail.vbs echo wshshell.AppActivate"欢迎使用 Microsoft Outlook 2010">>mail.vbs echo WScript.Sleep 5000>>mail.vbs echo wshshell.SendKeys"%%N" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Microsoft Outlook 帐户设置">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"%%N" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"添加账户">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"%mailname%">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"%mailname%@cbsi.com.cn">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 10000>>mail.vbs echo wshshell.SendKeys"%mailpassword%">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys" ">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 10000>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs rem 设置接受发送时间 echo WScript.Sleep 30000>>mail.vbs echo wshshell.SendKeys"%%F" >>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"%%T" >>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"%%D" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"1">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"1">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"{ESC}">>mail.vbs rem 设置签名 echo WScript.Sleep 3000>>mail.vbs echo wshshell.SendKeys"%%F" >>mail.vbs echo WScript.Sleep 5000>>mail.vbs echo wshshell.SendKeys"%%T" >>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"%%N" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"%%N" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"新签名">>mail.vbs echo wshshell.SendKeys"mail">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo MsgBox "配置完成,请修改桌面《邮件签名模板.doc》文件,之后全选覆盖粘贴到本输入框,点击确定即可。",0,"配置完成" >>mail.vbs rem 删除vbs文件本身 echo Set fso =CreateObject("Scripting.Filesystemobject")>>mail.vbs echo fso.DeleteFile(WScript.ScriptFullName) >>mail.vbs rem 运行vbs文件 start mail.vbs exit :office2013 echo 请输入您的邮箱用户名(例如hello3389): set /p mailname= echo. echo 请输入您的邮箱密码: set /p mailpassword= rem 生成vbs文件 echo set xnet = createobject("wscript.network")>mail.vbs echo Dim strPrgpth>>mail.vbs echo strPrgpth ="C:\Program Files (x86)\Microsoft Office\Office15\Outlook.exe">>mail.vbs echo Set wshshell=CreateObject("wscript.shell")>>mail.vbs echo Set oexec=wshshell.Exec(strPrgpth)>>mail.vbs echo WScript.Sleep 30000>>mail.vbs echo wshshell.AppActivate"欢迎使用 Microsoft Outlook 2013">>mail.vbs echo WScript.Sleep 5000>>mail.vbs echo wshshell.SendKeys"%N" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Microsoft Outlook 帐户设置">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"%N" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"添加账户">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"%mailname%">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"%mailname%@cbsi.com.cn">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 10000>>mail.vbs echo wshshell.SendKeys"%mailpassword%">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys" ">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 10000>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs rem 设置接受发送时间 echo WScript.Sleep 30000>>mail.vbs echo wshshell.SendKeys"%%F" >>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"%%T" >>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"%%D" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"1">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"发送/接受组">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"1">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.SendKeys"{ESC}">>mail.vbs rem 设置签名 echo WScript.Sleep 3000>>mail.vbs echo wshshell.SendKeys"%%F" >>mail.vbs echo WScript.Sleep 5000>>mail.vbs echo wshshell.SendKeys"%%T" >>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"%%N" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"Outlook 选项">>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"%%N" >>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"新签名">>mail.vbs echo wshshell.SendKeys"mail">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 1000>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{DOWN}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshshell.SendKeys"{ENTER}">>mail.vbs echo WScript.Sleep 500>>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo wshShell.SendKeys "{Tab}">>mail.vbs echo wshshell.AppActivate"签名和信纸">>mail.vbs echo MsgBox "配置完成,请修改桌面《邮件签名模板.doc》文件,之后全选覆盖粘贴到本输入框,点击确定即可。",0,"配置完成" >>mail.vbs rem 删除vbs文件本身 echo Set fso =CreateObject("Scripting.Filesystemobject")>>mail.vbs echo fso.DeleteFile(WScript.ScriptFullName) >>mail.vbs rem 运行vbs文件 start mail.vbs exit :quit exit
本文出自 “Hello3389的博客” 博客,请务必保留此出处http://hello3389.blog.51cto.com/1171990/1600311
批处理自动配置Outlook账户
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。