Something like this. !! UNTESTED !!
Code:
$rc = ReadValue ("subkey", "entry")
If $rc <> "R:\"
WriteValue ("subkey", "entry", "expression", "data type")
$kill= EnumProcess("explorer.exe",1)
Else ?"No changes needed skipping to end."
EndIf
;
;Function EnumProcess($exe, optional $terminate, optional $Computer)
;
;To enumerate OR kill specific processes
;
;$exe: the process name OR numeric PID
;$terminate: null/notnull value to terminate the specified process(es)
;$Computer: the PC to Execute against. Null = local PC
;
;returns an array of PIDs (pipe seperated), If $exe is a process name
;
;To Return the pid of setup.exe
;$pid= EnumProcess("setup.exe")
;
;to terminate all running Internet Explorer windows
;$kill= EnumProcess("iexplore.exe",1)
;
;To terminate a specific exe by it's PID
;$pid=694
;$kill=EnumProcess($pid,1)
;
Function EnumProcess($exe, optional $terminate, optional $Computer)
Dim $winmgmts, $ExecQuery, $Process, $id
If NOT $computer
$computer=@wksta
EndIf
$winmgmts="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER"
Select
Case Val($exe)>0
$ExecQuery="select * from Win32_Process where ProcessId='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Process in $GetObject
If $terminate
$=$Process.Terminate
EndIf
$EnumProcess = $Process.name
Next
$GetObject=''
Case VarType($exe)=8
$ExecQuery="select * from Win32_Process where Name='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Process in $GetObject
If $terminate
$=$Process.Terminate
EndIf
$id=$Process.ProcessId
$EnumProcess = "$Id" + "|" + "$EnumProcess"
Next
$EnumProcess=Left($EnumProcess,Len($EnumProcess)-1)
$GetObject=''
Case 1
Exit 1
EndSelect
EndFunction