Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Permanently change the PATH from within a DOS Batch File  (Read 14376 times)

0 Members and 1 Guest are viewing this topic.

Dias de verano

  • Guest
Re: Permanently change the PATH from within a DOS Batch File
« Reply #30 on: April 15, 2009, 03:48:58 PM »
Here's my mountain of code to do the job I was after...

Code: [Select]
@echo off
set vara=%PATH%
set varb=;%SystemRoot%\sysfiles
set varc=%vara%%varb%
setx PATH %varc% -m
set vara=
set varb=
set varc=

not really sure the set vara=, set varb=, set varc= is necessary.



Nope. To add \dir to path: (you append it)

set path "%path%;\dir"

see here:

http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=setx+path&btnG=Google+Search&meta=lr%3D


iONik

    Topic Starter


    Beginner

    Re: Permanently change the PATH from within a DOS Batch File
    « Reply #31 on: April 15, 2009, 03:58:47 PM »
    Nope. To add \dir to path: (you append it)

    set path "%path%;\dir"

    see here:

    http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=setx+path&btnG=Google+Search&meta=lr%3D



    My "mountain of code" (not really) does do the trick, but you have cut that back about as far as it can go I'd guess.

    But I will need SETX

    Code: [Select]
    setx PATH "%PATH%;C:\Windows\newdir" -m