Page 1 of 1 1
Topic Options
#153383 - 2005-12-14 11:42 AM Modify Environment variables (PATH)
blackcure Offline
Fresh Scripter

Registered: 2005-06-30
Posts: 10
Hello All,

I want to modify Path varible in logoscript and I use the UDF PathMod() for this. My problem: It's necessary reboot the computer for apply this changes

Is there any form to do this in the session and no reboot??


Thanks

Top
#153384 - 2005-12-14 02:00 PM Re: Modify Environment variables (PATH)
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
you MIGHT be able to get away with it by killing all Explorer.exe processes and having the desktop reload
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153385 - 2005-12-14 02:14 PM Re: Modify Environment variables (PATH)
blackcure Offline
Fresh Scripter

Registered: 2005-06-30
Posts: 10
uff.. this alternative it's not viable..

Thanks

Top
#153386 - 2005-12-14 03:02 PM Re: Modify Environment variables (PATH)
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
PathMod() needs admin rights.

Have you looked into the various KiX SET commands?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#153387 - 2005-12-14 05:15 PM Re: Modify Environment variables (PATH)
blackcure Offline
Fresh Scripter

Registered: 2005-06-30
Posts: 10
I use PathMod() whith admin rights, whith this I update registry key but operating system not read this registry until next reboot or restart the session.
Top
#153388 - 2005-12-14 08:55 PM Re: Modify Environment variables (PATH)
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
You are doomed to do a reboot if you update the reg key.
The SET command Les suggested also works and does not need a reboot.
Do not forget the ; in front of the stuff to add. The @error and @serror macro’s and the sleep’s are there just for testing and can safely be removed.

Code:

Break on
$path = %path%
$path = $path + ";new stuff to add to path"
?$path
Sleep 2
Set "path = $path"
?@ERROR
?@SERROR
Sleep 2

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#153389 - 2005-12-14 09:24 PM Re: Modify Environment variables (PATH)
blackcure Offline
Fresh Scripter

Registered: 2005-06-30
Posts: 10
This is ok, but don't resolve the problem.
When the script finish, I lose the update path.
thanks

Top
#153390 - 2005-12-14 09:28 PM Re: Modify Environment variables (PATH)
blackcure Offline
Fresh Scripter

Registered: 2005-06-30
Posts: 10
I need to change the path for all the session.
I have users with no admins priviledge, then I need to copy executable files into a directory.This directory is de %temp%\user. I need update the path with this directory.

Top
#153391 - 2005-12-14 09:29 PM Re: Modify Environment variables (PATH)
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Sorry?
I just ran the script and the path gets the stuff I want to add. When I check the path variable the folder I just added is still there when the script ends.

What OS and kix version do you use? Did you use the exact script from above post or did you make modifications. Please post the script you use.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#153392 - 2005-12-14 09:36 PM Re: Modify Environment variables (PATH)
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Have you looked into the various KiX SET commands? I'm guessing not. Mart suggested only one of the three available.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#153393 - 2005-12-14 10:00 PM Re: Modify Environment variables (PATH)
blackcure Offline
Fresh Scripter

Registered: 2005-06-30
Posts: 10
I copy your scripts

OS: Windows XP sp2

Script:
Break on
$path = %path%
$path = $path + ";c:\a"
?$path
Sleep 2
Set "path = $path"
?@ERROR
?@SERROR
Sleep 2

In c:\a I have a executable banner.exe
START, run , execute banner.exe and fail
I just ran the script the path variable not have c:\a

Top
#153394 - 2005-12-14 10:18 PM Re: Modify Environment variables (PATH)
blackcure Offline
Fresh Scripter

Registered: 2005-06-30
Posts: 10
whith SET or SETL fail because (from manual):

If you start KiXtart from
a batch file, any commands in the batch file that are run after KiXtart exits do not see changes made by the SET or SETL commands. If you want to run batch files or programs that depend on settings set by KiXtart, start them from KiXtart using SHELL or RUN.

I think that with SETM don't fail

Special thanks to Lees and Mark

Thanks for all

Top
#153395 - 2005-12-14 10:18 PM Re: Modify Environment variables (PATH)
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Weird. It works great for me.
What OS are you running on and what kix version do you use? You spoke of changing it for each session, are you running it on a terminal server?

Like Less said there are some kix commands dealing with environment vars, have a look in the manual for the proper syntax and functionality of these commands.

[edit]
Did not see your reply
Sweet. Hope you get it working whith the other commands.
[/edit]


Edited by Mart (2005-12-14 10:20 PM)

Top
Page 1 of 1 1


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

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

Generated in 0.067 seconds in which 0.027 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