ĿǰÓÐÕâÑùÒ»¸ö¿Í»§ÐèÇó£ºÔÚÒ»ÆÚÏîÄ¿µ±ÖУ¬¿Í»§¶Ë²»¼ÓÈëÓò£¬µ«ÒªÇóÅäÖò¢Ê¹Óÿͻ§¶ËµÄOutlook¡£ÓÉÓÚ¿Í»§¶ËÊýÁ¿½Ï´ó£¨´óÔ¼1200¸ö£©£¬ÊÖ¹¤ÅäÖÃÌ«·±Ëö£¬¹¤×÷Á¿Ò²·Ç³£¾Þ´ó£¬Òò´ËдÁËÒ»¸öOutlook¿Í»§¶ËÅäÖýű¾£¬Ë³±ãÌṩ´ó¼ÒÒ»¸ö²Î¿¼¡£
1¡¢ÎÒÃÇÐèÒªÓÐÒ»¸öOutlookÅäÖÃÎļþ£¨PRFÎļþ£©£¬´ËÅäÖÃÎļþµÄÉú³É¼°¾ßÌå²ÎÊýÇë²Î¿¼http://technet.microsoft.com/zh-cn/library/cc179062(TechNet.10).aspx
2¡¢Ö´ÐÐдºÃµÄ½Å±¾½«ÅäÖÃÎļþµ¼Èë²¢ÅäÖÃOutlook¿Í»§¶Ë¼´¿É£¨PRFÅäÖÃÎļþÐèÒªÓë½Å±¾ÔÚͬһĿ¼£¬²¢Ôڽű¾ÖÐÖ¸¶¨PRFÎļþµÄÃû³Æ£©
3¡¢½Å±¾ÄÚÈÝ
'===================================================================
'
' VBScript Source File
'
' NAME: Billy Fu
'
' AUTHOR: OutlookÅäÖýű¾-Outlook_Profile_Config
'
' DATE : 2008/7/14
'
'
'===================================================================
ON ERROR RESUME NEXT
Const OFFICE11_PATH = "C:\Program Files\Microsoft Office\Office11"
Const OFFICE12_PATH = "C:\Program Files\Microsoft Office\Office12"
dim strUserName
dim intOfficeVer
dim strOfficePath
strUserName = ""
intOfficeVer = ""
strOfficePath = ""
strUserName = InputBox("ÇëÊäÈëÄúÔÚÓòÖеÄÓû§ÕʺÅ,¸ñʽÈ磺BillyFu","OutlookÅäÖýű¾")
If strUserName = "" Then
Msgbox "È¡ÏûOutlookÅäÖã¡"
Else
while intOfficeVer = ""
intOfficeVer = InputBox("ÇëÊäÈëÄú±¾»ú°²×°µÄOutlook°æ±¾ºÅ:2007»ò2003£¬ÆäËû°æ±¾²»Ö§³Ö","OutlookÅäÖýű¾","2003")
if intOfficeVer = "" then
Msgbox "Outlook ÉèÖÃÈ¡Ïû£¡"
intOfficeVer = "error"
else
if intOfficeVer <> "2007" And intOfficeVer <> "2003" Then
intOfficeVer = ""
else
if intOfficeVer = "2007" then
strOfficePath = OFFICE12_PATH
else
strOfficePath = OFFICE11_PATH
end if
strOfficePath = InputBox("ÇëÈ·¶¨Äú±¾»ú°²×°µÄOutlook·¾¶","OutlookÅäÖýű¾",strOfficePath)
Call InstallOutlookProfile
end if
end if
Wend
End If
sub InstallOutlookProfile
ModifyPRFFile
Dim WshShell
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Dim strPath
strPath = WScript.ScriptFullName
strPath = Left(strPath, InstrRev(strPath, "\")) & "OutlookProfile1.PRF" 'Ö¸¶¨Outlook PRF ÅäÖÃÎļþ
dim strCmd
strCmd = """" & strOfficePath & "\outlook.exe"" /importprf """ & strPath & """"
WshShell.Run strCmd, 1, false
end sub
sub ModifyPRFFile
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim strCon
Dim fso, f1, f2, ts
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.GetFile("OutlookProfile.PRF") 'ÉèÖôÓOutlookÅäÖÃÎļþÖжÁÈ¡ÐÅÏ¢
Set ts = f1.OpenAsTextStream(ForReading, TristateUseDefault)
strCon = ts.ReadAll
ts.close
strCon = Replace(strCon,"%UserName%",strUserName)
fso.CreateTextFile "OutlookProfile1.PRF"
Set f2 = fso.GetFile("OutlookProfile1.PRF") '´´½¨Ò»¸öÅäÖÃÎļþ
Set ts = f2.OpenAsTextStream(ForWriting, TristateUseDefault)
ts.Write strCon
ts.Close
end sub
sub Err
if err <> 0 then
Wscript.echo "OutlookÅäÖýű¾³ö´í£¬×Ô¶¯Í˳ö£¡"
Err.Clear
end if
end sub