RE: Edit Windows PATH
- From: Luke.Bakken@xxxxxxxxxxxxx (Luke Bakken)
- Date: Wed, 27 Apr 2005 09:05:09 -0700
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.
.
- Follow-Ups:
- RE: Edit Windows PATH
- From: Chris Devers
- RE: Edit Windows PATH
- Prev by Date: Re: REGEXP removing - il- - -b-f and - il- - - - f
- Next by Date: RE: Spread***::ParseExcel - Out of memory error
- Previous by thread: Re: Edit Windows PATH
- Next by thread: RE: Edit Windows PATH
- Index(es):