|
<?php
//
//Reading Registry entry.
//
$Wshshell= new COM('WScript.Shell');
$data= $Wshshell->regRead('HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip\path');
echo "Data--->".$data."<br/>";
//
//Function for writing to the the Registry.
//
function registry_write($folder, $key, $value, $type="REG_SZ")
{
$WshShell = new COM("WScript.Shell");
$registry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\" . $folder . "\\" . $key;
try{
$result = $WshShell->RegWrite($registry, $value, $type);
echo "Entry is Successfully written at:".$registry;echo "<br/>";
return($result);
}
catch(Exception $e){
echo "Some Exception in Registry writing".$e;echo "<br/>";
}
return false;
}
//
//Function for deleting the entry from the registry.
//
function registry_delete($folder, $key, $value, $type="REG_SZ")
{
$WshShell = new COM("Wscript.shell");
$registry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\" . $folder . "\\" . $key;
try{
$result = $WshShell->RegDelete($registry);
echo $key." is Successfully deleted from HKEY_LOCAL_MACHINE\\SOFTWARE\\" . $folder ;
return($result);
}
catch(Exception $e){
echo "Some Exception with the code:<br/>".$e;
}
return false;
}
$folder = "7-ZIP";
$key = "Mac";
$value = "123";
//
//If you want to use the registry_write() function,than use that function.
//If you want to use the registry_delete() function,than use that function.
//
//registry_write($folder,$key,$value);
registry_delete($folder,$key,$value);
?>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.