Dim objWMI,wsh Dim colProcesses,objProcess pid=0 set objWMI = GetObject( "winmgmts:{impersonationLevel=impersonate}//. /root/cimv2" ) set colProcesses = objWMI.ExecQuery( "SELECT * FROM Win32_Process" _ " WHERE Name='explorer.exe'" ) for Each objProcess In colProcesses pid = objProcess.ProcessId Next
set wsh = WScript.CreateObject("WScript.Shell") wsh.AppActivate pid wsh.sendKeys "%{F4}"