VBScript自动配置Perl 5.14.2+Padre的环境变量

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

Option Explicit
Dim pSysEnv
Dim objFSO
Set pSysEnv = CreateObject("WScript.Shell").Environment("System")
Set objFSO=CreateObject("Scripting.FileSystemObject")

Function IsMatch(Str, Patrn)  
  Dim r
  Set r = new RegExp
  r.Pattern = Patrn  
  IsMatch = r.test(Str)
  Set r = Nothing 
End Function  
  
Sub SetEnv(pPath, pValue)
    Dim ExistValueOfPath
    IF pValue <> "" Then
        ExistValueOfPath = pSysEnv(pPath)
        IF Right(pValue, 1) = "\" Then pValue = Left(pValue, Len(pValue)-1)
        If IsMatch(ExistValueOfPath, "\*?" & Replace(pValue, "\", "\\") & "\\?(\b|;)") Then Exit Sub
        If ExistValueOfPath <> "" Then pValue = ";" & pValue
        pSysEnv(pPath) = ExistValueOfPath & pValue
    Else
        pSysEnv.Remove(pPath)
    End IF
End Sub

SetEnv "Path", objFSO.GetFolder(".").Path & "\perl\bin;" & objFSO.GetFolder(".").Path & "\perl\site\bin;" & objFSO.GetFolder(".").Path & "\c\bin"
Set pSysEnv = Nothing
Dim oShell
Set oShell = WScript.CreateObject("WScript.Shell")
oShell.Exec objFSO.GetFolder(".").Path & "\perl\site\bin\padre.exe"
Set oShell = Nothing