Page 1 of 1

Refresh Registry [Windows]

Posted: Wed Jun 05, 2019 9:53 am
by RASHAD
Hi
Example : After auto arrange Icons
#1 : Using VBscript

Code: Select all

RunProgram("REG"," ADD "+Chr(34)+"HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop"+Chr(34)+" /V FFLAGS /T REG_DWORD /D 1075839524 /F","")
OpenFile(0,GetHomeDirectory()+"rashad.vbs")
  Restore StringData
  For i = 1 To 10
    Read.s MyData$
    WriteStringN(0,MyData$)
  Next
CloseFile(0)
RunProgram(GetHomeDirectory()+"rashad.vbs","","",#PB_Program_Hide)
Delay(50)
;DeleteFile(GetHomeDirectory()+"rashad.vbs")
  
DataSection    
  StringData:
    Data.s "Function RefreshExplorer()"
    Data.s "dim strComputer, objWMIService, colProcess, objProcess"
    Data.s "strComputer = "+Chr(34)+"."+Chr(34)
    Data.s "Set objWMIService = GetObject("+Chr(34)+"winmgmts:"+Chr(34)+" & "+Chr(34)+"{impersonationLevel=impersonate}!\\"+Chr(34)+" & strComputer & "+Chr(34)+"\root\cimv2"+Chr(34)+")"
    Data.s "Set colProcess = objWMIService.ExecQuery ("+Chr(34)+"Select * from Win32_Process Where Name = 'explorer.exe'"+Chr(34)+")"
    Data.s "For Each objProcess in colProcess"
    Data.s "objProcess.Terminate()"
    Data.s "Next"
    Data.s "End Function"
    Data.s "Call RefreshExplorer"
EndDataSection

#2 : Using PowerShell

Code: Select all

RunProgram("REG"," ADD "+Chr(34)+"HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop"+Chr(34)+" /V FFLAGS /T REG_DWORD /D 1075839524 /F","")
RunProgram("powershell.exe","stop-process -name explorer -force","",#PB_Program_Hide)

Re: Refresh Registry [Windows]

Posted: Wed Jun 05, 2019 11:25 am
by Kwai chang caine
I don't know if that works, because i not have something to change, needed to refresh BDR for the moment :oops:
But i have often search this style of code in the past time :|
In all case, thanks for sharing MASTER this usefull code 8)