1.将OutLook.exe注册为服务,让其一直保持开启状态
类似于TaobaoProtect.exe是由TBSecSvc服务启动的
http://stackoverflow.com/questions/3582108/create-windows-service-from-executable#
You can use sc.exe
(required when using Powershell):
sc create <new_service_name> binPath= "<path_to_the_executable>"
(must have quotation marks around the actual exe
path)
More info is available from Microsoft KB.
需要注意的是binPath=后面有一个空格,千万不要漏掉。
C:WindowsSystem32>sc create OutLook binPath= "C:Program Files (x86)Microsoft
OfficeOffice12OUTLOOK.EXE"
[SC] CreateService 成功
控制面板-->管理工具-->服务
找到刚才新建的服务,设置启动类型为自动
启动服务的时候,一直提示Error 1053
貌似需要exe本身支持服务才可以
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686953(v=vs.85).aspx
http://stackoverflow.com/questions/8972679/windows-7-bat-file-not-starting-as-a-service
You get the first error because your batch file is unable to negotiate/interact with the Windows Services subsystem. When Windows starts a Service, the OS waits a few seconds for the Service to report that is has started properly. If this signal never arrives (as with your batch file, which doesn't know anything about Services), Windows will report error #1053.
You will need a "wrapper" application to run your batch file as a service. The free "SRVANY" utility from Microsoft may work for you but you should investigate the more fully-featured commercial alternatives as well.
============
做了个bat脚本,比较麻烦
cd "C:Program Files (x86)Microsoft OfficeOffice12"
OutLook.exe
exit
2.使用第三方的插件
https://superuser.com/questions/189905/how-to-make-outlook-2010-minimize-when-i-try-to-close-it
outlook2010测试失败