<?php
//
// getvolumeID.php : get any volumeID
//
//VGR10042003
//VGR21082009 ADDed code et enrobage
//
$drive='C:'; // adapt to your needs
// prepare command
$syscmd="dir $drive";
// execute, get results
$fp=popen($syscmd,'r');
if ($fp) { // ok
// read
$continue=TRUE;
while ((!feof ($fp))and $continue) {
$buffer = fgets($fp, 4096);
$continue=(strpos($buffer,'-')===FALSE); // the volumeID is the first that may contain a dash
}
// close
pclose($fp);
// extract information
$expl=explode(' ',$buffer);
$poubStr=$expl[count($expl)-1];
// display
echo "the Volume ID of $drive is $poubStr<BR>";
} else echo "the command '$syscmd' could not be executed";
//end
?>
for European Experts Exchange and Edaìn Works back to list of test scripts
Last update 2009-10-30 09:20:01
| Add This Article To: | |||
| |
|
|
|
| |
|
|
|