/* Check and parse command line arguments */ Parse Arg section key If key = "" Then Call Syntax Parse Value section With hive"\"tree If Pos( "HKEY_", Translate( hive ) ) <> 1 Then Call Syntax /* Initialize W32Funcs */ Call RxFuncAdd "w32loadfuncs", "W32Util", "w32loadfuncs" Call w32loadfuncs /* Read default printer and port from registry */ handle = w32RegOpenKey( hive, tree ) regval = w32RegQueryValue( handle, key ) Call w32RegCloseKey handle /* Display the result */ Say Say "["||section||"]" Say key||"="||regval /* Normal program termination */ Exit 0 Syntax: Say Say "ReadREG.rex, Version 1.00" Say "Read a value from the registry" Say Say 'Usage: READREG.REX "section" "key"' Say say 'Where: "" is your Rexx interpreter:' say " - Windows: REGINA.EXE or REXX.EXE, whichever you installed" say " - OS/2: no need to specify, just rename script to *.cmd" Say ' "section" is the registry section name, without brackets' Say ' "key" is the key whose value must be read' Say Say "Arguments should be enclosed in double quotes if they contain spaces" Say Say "Example: read the user part of the PATH environment variable:" Say 'READREG.REX "HKEY_CURRENT_USER\Environment" "Path"' Say Say "Written by Rob van der Woude" Say "http://www.robvanderwoude.com" Exit 1 Return