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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

two question on win32 machines

Status
Not open for further replies.

NEVERSLEEP

Programmer
Apr 14, 2002
667
CA
1:
on my 2kpro machine...
print $^O; # returns MSWin32
how can i be sure the client os is 2k ?

2:
how can i use the Open($Register,$hkey) here
to display all sub directory also.
this must also apply to GetKeys & GetValues methods
here what i got (this dont do sub! please optimize my code)

Code:
use strict;
use Win32::Registry;

my $Register = "";
my ($hkey, @key_list, $key, $root);
my @roots = ($HKEY_CLASSES_ROOT,$HKEY_CURRENT_USER,$HKEY_LOCAL_MACHINE,$HKEY_CURRENT_CONFIG);

foreach $root (@roots) {
  $root->Open($Register,$hkey) || die "\n$! dead in ($root)" ;
  $hkey->GetKeys(\@key_list);
  print "$Register keys\n";
  foreach $key (@key_list) {
   print "$key\n";
  }
 $hkey->Close();
}
print "\nhit enter to quit";
sleep unless <stdin>;
exit;

thanks alot! ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
ok for 1 ive found it...
Code:
$client_os = `echo %os%`;
chomp $client_os;
but this wont differ between nt and 2k...
any better idea ? ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
ok -- cool, I wouldn't have thought of that.

Why do you need to differentiate between NT and 2K? They're both NT really..... Mike
______________________________________________________________________
&quot;Experience is the comb that Nature gives us after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
how about #2 mike ? ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
#2? Mike
______________________________________________________________________
&quot;Experience is the comb that Nature gives us after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
2:
how can i use the Open($Register,$hkey) here
to display all sub directory also.
this must also apply to GetKeys & GetValues methods
here what i got (this dont do sub! please optimize my code)

Code:
use strict;
use Win32::Registry;

my $Register = &quot;&quot;;
my ($hkey, @key_list, $key, $root);
my @roots = ($HKEY_CLASSES_ROOT,$HKEY_CURRENT_USER,$HKEY_LOCAL_MACHINE,$HKEY_CURRENT_CONFIG);

foreach $root (@roots) {
  $root->Open($Register,$hkey) || die &quot;\n$! dead in ($root)&quot; ;
  $hkey->GetKeys(\@key_list);
  print &quot;$Register keys\n&quot;;
  foreach $key (@key_list) {
   print &quot;$key\n&quot;;
  }
 $hkey->Close();
}
print &quot;\nhit enter to quit&quot;;
sleep unless <stdin>;
exit;
---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
is there like a special operator ?
that will NOT limit the search ? ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top