Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts

    Batch Program to Add to Environment Variables

    How would I go about writing a batch program (or whatever needs to be written) that adds to the system's environment PATH variable permanently? I was trying to use SET but that only adds for the current CMD.exe session. I'm planning on having the (windows) users enter the path to their PHP and MySQL executables and then add those paths to the windows environment %path%. That way they can use php and mysql from the command line by simply typing in php and mysql as the command instead of the complete path.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,838
    Thanks
    2
    Thanked 160 Times in 155 Posts
    If PHP and MySQL were installed properly, they should already be in the path environment. If not, then the administrator of the box should fix it. You should not create a batch file to do this.

    Right click the "My Computer" icon on the desktop and select 'Properties'.
    Click on the "Advanced" tab then "Environment Veriables".
    In the "System Variables" scroll down to the 'Path' environment and edit it as needed.

  • #3
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    Hmmm I guess the (PHP and MySQL) installers doesn't (or at least didn't when I installed) set them in the Path. Yeah, I've actually did a video showing them how to manually do it themselves, but someone asked if I could write a batch file to have this done automatically. I could use SETX but thats not guaranteed to be on everyone's systems. I'll just let them watch the tutorial and post additional questions but I think its straight forward. Thanks
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #4
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    It's been a while since I actually configured a windows box, but I recall there is some startup batch file that does some of the PATH configurations - autoexec.bat perhaps? I'm not sure on the name, but I know windows (at least up to Win2k) had such a file.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •