how to set PATH (environment) using WSH? 
Author Message
 how to set PATH (environment) using WSH?

In dos, you can type: path %path%;c:\newdirectory

and this will add the path "c:\newdirectory" to your existing path
environment within dos...

How can I set this through a script?  I need all my user's paths to have
"c:\newdirectory" appended to the end...



Tue, 22 Feb 2005 02:58:09 GMT  
 how to set PATH (environment) using WSH?

Quote:

> In dos, you can type: path %path%;c:\newdirectory

> and this will add the path "c:\newdirectory" to your existing path
> environment within dos...

> How can I set this through a script?  I need all my user's paths to
> have "c:\newdirectory" appended to the end...

On NT and higher, you can use the WshEnvironment object (via the WshShell.Environment property) to access and modify environment variables in the Process, User, System, and Volatile environments.  On Win9x/ME, only the Process environment is accessible, so changes made aren't persistent.

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Tue, 22 Feb 2005 07:33:44 GMT  
 how to set PATH (environment) using WSH?
can you show me an example of how append a directory to the system path, for
a windows 2000 machine?



Quote:

> In dos, you can type: path %path%;c:\newdirectory

> and this will add the path "c:\newdirectory" to your existing path
> environment within dos...

> How can I set this through a script?  I need all my user's paths to
> have "c:\newdirectory" appended to the end...

On NT and higher, you can use the WshEnvironment object (via the
WshShell.Environment property) to access and modify environment variables in
the Process, User, System, and Volatile environments.  On Win9x/ME, only the
Process environment is accessible, so changes made aren't persistent.

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Tue, 22 Feb 2005 23:14:42 GMT  
 how to set PATH (environment) using WSH?

Quote:

> can you show me an example of how append a directory to the system path, for
> a windows 2000 machine?

Hi

As I said in the other post, you should use pathman.exe for this, but if you
want a VBScript example see this article:


Subject: Re: Path and vbscript
Newsgroups: microsoft.public.scripting.vbscript
Date: 2002-07-31 23:51:05 PST
http://groups.google.com/groups?selm=o7lhkuknb0fao0kvr93ug4kdmb0r6aoh...

You must change the line
   Set uENV = oWSH.Environment("USER")

to
   Set uENV = oWSH.Environment("SYSTEM")

to update the system path.

--
torgeir



Wed, 23 Feb 2005 00:38:48 GMT  
 how to set PATH (environment) using WSH?

Quote:

> In dos, you can type: path %path%;c:\newdirectory

> and this will add the path "c:\newdirectory" to your existing path
> environment within dos...

> How can I set this through a script?  I need all my user's paths to have
> "c:\newdirectory" appended to the end...

For WinNT/Win2k/WinXP, I strongly recommend Pathman.exe (Path Manager) from the
Windows 2000 Resource kit! It works on WinXP and Win Nt 4.0 as well. Use e.g.
the Run method from your script to run pathman.

Download Pathman.exe from here:
http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/p...

It will e.g. handle repeated entries correctly.

Run pathman /? in a command prompt for more help...

--
torgeir



Wed, 23 Feb 2005 00:34:00 GMT  
 how to set PATH (environment) using WSH?
does it need admin rights?


Quote:

> > In dos, you can type: path %path%;c:\newdirectory

> > and this will add the path "c:\newdirectory" to your existing path
> > environment within dos...

> > How can I set this through a script?  I need all my user's paths to have
> > "c:\newdirectory" appended to the end...

> For WinNT/Win2k/WinXP, I strongly recommend Pathman.exe (Path Manager)
from the
> Windows 2000 Resource kit! It works on WinXP and Win Nt 4.0 as well. Use
e.g.
> the Run method from your script to run pathman.

> Download Pathman.exe from here:

http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/p...
o.asp

- Show quoted text -

Quote:

> It will e.g. handle repeated entries correctly.

> Run pathman /? in a command prompt for more help...

> --
> torgeir



Wed, 23 Feb 2005 01:53:29 GMT  
 how to set PATH (environment) using WSH?

Quote:


> > Download Pathman.exe from here:

> http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/p...
> o.asp

> > It will e.g. handle repeated entries correctly.

> > Run pathman /? in a command prompt for more help...

> does it need admin rights?

Yes, you will need admin rights for all changes to the system environment. If
you don't have admin rights, you can update the user path instead. Pathman.exe
supports this as well.

--
torgeir



Wed, 23 Feb 2005 02:16:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Set path environment

2. set environment variable path

3. setting environment variables from WSH?

4. Set a environment variable with wsh

5. How to set an environment variable with WSH?

6. How to set an environment variable with WSH?

7. Permission denied when retrieving environment variables using wsh from asp

8. Expanding SYSTEM %PATH% with embedded SYSTEM environment variable problem

9. manipulate Environment Path

10. cscript and the PATH-environment variable

11. Building paths with environment variables

12. Environment variable PATH

 

 
Powered by phpBB® Forum Software