Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading the Registry

Windows Specific

Reading the Registry

by  skiflyer  Posted    (Edited  )
Using the COM abilities of PHP it's trivial to read registry values from your windows SERVER. This is alright for Web based activities, but often more useful when using PHP for standalone scripting.

Here's a simple example one can use to find out where the Microsoft .NET compiler executable is located on their machine.

Code:
$shell = new COM("WScript.Shell") or die("Requires Windows Scripting Host");


$devenvpath=$shell->RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\devenv.exe\\");

One thing I've overlooked a few times in the past is when cutting and pasting the value from regedit, you'll need to remember to escape the \'s by turning them into \\'s

Hope this helps.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top