Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do I need to modify this to run as a logon script?

Status
Not open for further replies.

gmagerr

Technical User
Aug 11, 2001
323
0
0
US
Hi guys i figured out how to modify the system path. Do i need to do anything special to have this run at logon? thanks.
Code:
Dim ExistingPath, NewPath
Set objShell = WScript.CreateObject("WScript.Shell")
Set objEnv = objShell.Environment("SYSTEM")

'==========================================================================
' Add your Path Entry Here 
'==========================================================================
ExistingPath = objEnv("PATH")
WScript.Echo ExistingPath
If InStr(1, ExistingPath, "c:\msys\1.0\bin;c:\usr\local\cell\host-win32\bin;c:\usr\local\cell\host-win32\ppu\bin;c:\usr\local\cell\host-win32\spu\bin;c:\usr\local\cell\host-win32\Cg\bin", VBTextCompare) Then
WScript.Echo("Path already modified")
WScript.Quit

Else
NewPath = ExistingPath & ";" & "c:\msys\1.0\bin;c:\usr\local\cell\host-win32\bin;c:\usr\local\cell\host-win32\ppu\bin;c:\usr\local\cell\host-win32\spu\bin;c:\usr\local\cell\host-win32\Cg\bin"
objEnv("PATH") = NewPath 'WRITE NEW PATH, INCLUDING OLD ONE
WScript.Echo NewPath
End If
 
If the script works when you manually run it, it should work as a part of a login script. I would recommend that you don’t put any echos in the script. If you want an echo, make it a single echo at the end.

You probably don’t want to click OK 3 times every time you log in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top