Category: | Win32 Stuff |
Author/Contact Info | Ray Espinoza ray.espinoza@ebay.com |
Description: | This program will add a System Environment Variable. It will require a reboot to take effect. |
#!D:\perl\bin\perl use strict; my ($Reg, $Host, $Key, $Value); use Win32::TieRegistry ( TiedRef => \$Reg, ArrayValues => 1, Delimiter => '/', ':REG_' ); # Asking for machine name and info to be added to the sys env var print "What host would you like to connect to? "; chomp($Host = <STDIN>); print "What name would you like for the Sys Environment Variable? "; chomp($Key = <STDIN>); print "What value would you like to assign to this variable? "; chomp($Value = <STDIN>); # this is the system environment variable area done on the registry my $SysEnv= $Reg->Connect("$Host", "LMachine/System/CurrentControlSet/ +Control/Session Manager/Environment/") or die "Can't connect to $Host 's registry or can't open Registry + key, Session Manager/Environment: $^E +\n"; # create a new value and set it's data $SysEnv->{"/$Key"} = "$Value"; |
|
---|
Replies are listed 'Best First'. | |
---|---|
(tye)Re: SysEnvAdd.pl
by tye (Sage) on Jul 19, 2001 at 21:28 UTC | |
by RayRay459 (Pilgrim) on Jul 19, 2001 at 23:07 UTC |
Back to
Code Catacombs