VBS 强制关闭Symantec Endpoint Protection的代码

2019-01-15 23:02:48王冬梅

        strFilePath = Trim( myFilePath )
        strSection  = Trim( mySection )
        strKey          = Trim( myKey )
        strValue        = Trim( myValue )

        Set objFSO   = CreateObject( "Scripting.FileSystemObject" )
        Set wshShell = CreateObject( "WScript.Shell" )

        strTempDir  = wshShell.ExpandEnvironmentStrings( "%TEMP%" )
        strTempFile = objFSO.BuildPath( strTempDir, objFSO.GetTempName )

        Set objOrgIni = objFSO.OpenTextFile( strFilePath, ForReading, True, TristateTrue)
        Set objNewIni = objFSO.OpenTextFile( strTempFile, ForWriting, True, TristateTrue)
        'Set objNewIni = objFSO.CreateTextFile( strTempFile, False, False )

        blnInSection         = False
        blnSectionExists = False
        ' Check if the specified key already exists
        blnKeyExists         = ( ReadIniUnicode( strFilePath, strSection, strKey ) <> "" )
        blnWritten           = False

        ' Check if path to INI file exists, quit if not
        strFolderPath = Mid( strFilePath, 1, InStrRev( strFilePath, "" ) )
        If Not objFSO.FolderExists ( strFolderPath ) Then
                REM WScript.Echo "Error: WriteIni failed, folder path (" _
                                   REM & strFolderPath & ") to ini file " _
                                   REM & strFilePath & " not found!"
                Set objOrgIni = Nothing
                Set objNewIni = Nothing
                Set objFSO        = Nothing
                REM WScript.Quit 1
                Exit Sub
        End If