YNY
Full Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору The following VBScript example shows how to use the EnumKey method to enumerate the services listed as subkeys in the registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services You can save the script as a file with a .vbs extension and send the output to a file by executing the command line in the folder that contains the script: cscript Filename.vbs > output.txt const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_ strComputer & "\root\default:StdRegProv") strKeyPath = "SYSTEM\CurrentControlSet\Services" objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys WScript.Echo "Subkeys under " _ & "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" For Each subkey In arrSubKeys WScript.Echo subkey Next In scripting or Visual Basic, the method returns an integer that is 0 (zero) if successful. If the function fails, the return value is a nonzero error code that you can look up in WbemErrorEnum - переменная. |