Question Locked

How do you modify the Win32 PATH statement in a Perl script?

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have been all over Google searching for this answer and I have yet to come across something substantial that addresses this piece.

What I need to do is have my perl script add/modify the windows path statement to include a few directories that are required to run programs ONLY during the execution of the perl script.

I.E.: Program 123.exe is located in C:\123\ and program 456.exe is located in C:\Program Files\456\. I do not want the path for either 123.exe and 456.exe to be globally available.

Thanks in advance.

2 replies

by robo_dev

If so, why not just make a shortcut to cmd and adjust the "start in" properties of the shortcut? By setting the 'start-in' explicitly, the script will find the other executables.

This would allow the perl script to find the other programs, and you would not need to modify the path.

There's a big difference if your 'programs' are DOS programs or Windows programs. If they are DOS, you need to set environment as part of invoking command.com. If they are windows programs, you would need to interact with the registry (VBS would be easier for this) to read/write registry entries.

http://windowsitpro.com/article/articleid/23932/rem-changing-environment-variables-in-perl-scripts.html

This discussion is closed to new replies.