Page 1 of 1 1
Topic Options
#48007 - 1999-08-06 01:33 PM How to change NT environment
Anonymous
Unregistered


I think I've found a way to change the PATH statement in NT but it does not take until the user logs in the next time. Is there a different way?

IF @INWIN = 1 ; For Windows NT
$Env = ReadValue("HKEY_CURRENT_USER\Environment","PATH")
$NewEnv = "$Env" + ";u:\"
WriteValue("HKEY_CURRENT_USER\Environment","PATH","$NewEnv","REG_SZ")
ENDIF



Top
#48008 - 1999-08-06 03:58 PM Re: How to change NT environment
Anonymous
Unregistered


You can use the SET command to change the Path.

$path = %path%
set("path=$path;u:\")

------------------
Lon Geefshuysen,
www.xs4all.nl/~longeef/NT/KiXtart
lon_geefshuysen@essentium.com



Top
#48009 - 1999-08-10 12:43 AM Re: How to change NT environment
Anonymous
Unregistered


Lon, I should have been clearer. I don't want this to turn into a novel so here are some definitions.

SV = System Path Variable
UV = User Path Variable
NW = NetWare Map Path
AU = Autoexec Path
KV = Script Variable addition

When I use the SET command it looks like SV;\\machine\NETLOGON;SV;UV;AU;KV;NW;AU which is close but not what I wanted.

When I use the SETM command it looks like \\machine\NETLOGON;SV;UV;AU;KV;UV;NW;AU which is just as bad.

I want to be able to change either the SV or UV directly and not have duplicate entries in the PATH when I'm done.

Top
#48010 - 1999-08-13 12:17 AM Re: How to change NT environment
Anonymous
Unregistered


Ok, I couldn't figure out a way to set the path on the fly. Here's what I came up with. If anyone knows of a better way I'd appreciate it.

Thx,; Environment modification
$v = INSTR("%PATH%","U:\" ) ; Checks if script
If $V > 0 ; modification exists
Goto PathSet
EndIf
If @INWIN = 1 ; For Windows NT
$LF = chr(13) + chr(10)
$Message = "Hello, @FullName." + $LF + $LF
+ "Your systems local environment has been changed." + $LF + $LF
+ "Changes such as these should only occur ocasionally but" +$LF
+ "do require you to logon once again." + $LF + $LF
+ "We are sorry for the inconvience and if you have any questions" + $LF
+ "please feel free to contact your Network Administrator." + $LF + $LF + $LF
+ " Have a nice day." + $LF + $LF
$Env = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment","Path")
$NewEnv = "$Env" + ";U:\"
WriteValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment","Path","$NewEnv","REG_SZ")
MessageBox($Message,"System Update - @Date",4160,15)
$RC = LogOff(1)

EndIf
If @INWIN = 2 ; For Windows 9x
Shell "WINSET PATH=%PATH%;U:\"
EndIf
:PathSet



Top
#48011 - 1999-08-12 02:26 PM Re: How to change NT environment
Anonymous
Unregistered


I can't believe it. Found "PATHMAN.EXE" on the Resource Kit. I've also taken out the comments as my last post got messed up.

; Environment modification
$v = INSTR("%PATH%",U:\")
If $v > 0
Goto PathSet
EndIf
If @INWIN = 1
Shell "PATHMAN /AS U:\"
EndIf
If @INWIN = 2
Shell "WINSET PATH=%PATH%;U:\"
EndIf
:PathSet

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2197 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.092 seconds in which 0.067 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org