RE: Edit Windows PATH



Chris Devers wrote:
> On Fri, 1 Jan 1988, amr wrote:
>
>> Do we have Perl script that can edit & add to the Windows (XP, 2000)
>> path.?
>
> Is there a reason that a simple system() command won't work here?
>
> my $status = system( "SET PATH=%PATH%;$new_path" );
> die "Couldn't set %PATH%: $!" if $status;
>
> Normally I'm opposed to using system commands when the task can be
> done either all in Perl or with a platform- and problem- specific
> module, but in this case, the cmd shell's SET command is easy to run
> directly, so why not just solve the problem that way?

That will change the environment for the cmd.exe process that is
executed by that one system() call. Changing %ENV will change the
environment for all processes started by the perl script.

Changing the global path requires registry trickery, IIRC.
.