Sign in to follow this  
Followers 0
nitro322

updating path for Wn9x

8 posts in this topic

I've written a helper script that I can use when installing applications to automatically update the system path (if necessary). Useful for installng CLI programs such as nmap.

Anyway, setting the path in NT is easy: update the regkey and call envupdate(). Perfect, everytime (and THANK YOU to whoever wrote that function :-).

9x is tricker, though. Based on my research, it seems that updating it through autoexec.bat is the best and most reliable way of doing it. So, I scripted that, and have that working perfectly after a reboot. However, I'd like to enable Win9x users to use the program without a reboot, just like NT users can do.

Is there any way to do this? envupdate() doesn't update the path on 9x (at least not through autoexec.bat), and I haven't been able to figure out any other way to do this. Any suggestions?

Thanks!

Share this post


Link to post
Share on other sites



Only way I know of is:

Use at own risk of cource

ProcessClose('explorer.exe')
Sleep(2000)
If Not ProcessExists('explorer.exe') Then Run('explorer.exe')

Share this post


Link to post
Share on other sites

Wow. Umm, looks effective, but are there any other, maybe less extreme, suggestions? :-)

Share this post


Link to post
Share on other sites

yes simply update the autoexec.bat and run it in windows and thats it :-)

Share this post


Link to post
Share on other sites

kloyenz, what do you mean by run it in Windows? If I do that, the new path only gets applied to the local shell that it's run from. Windows itself, on a global level, still doesn't know about the changes. Is there some special way I can run autoexec.bat to make it apply globally?

Share this post


Link to post
Share on other sites

nitro322,

There's a program on the W98 CD called winset.exe. This can be used to set global environmental variables. I seem to remember having to run the set command first - but I'm not sure.

It would look something like:

set path=%path%;newpath

winset path=%path%;newpath

it's worth a try..

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

There's a program on the W98 CD called winset.exe. This can be used to set  global environmental variables.

<{POST_SNAPBACK}>

This is perfect! I've never heard of this program before, but it does exactly as you said. Rock on.

Any chance this capability could be added to the envupdate function? Or built into AutoIt in some other way? It'd be nice not to have to deal with an extra executable.

Either way, though, I'm quite happy right now. :-) Thanks again.

Edited by nitro322

Share this post


Link to post
Share on other sites

Ok, it's not perfect. It does apply the new path to all future processes, but still not explorer.exe itself. So, if I launch a new command prompt, then it works. However, if I try to run the command from explorer itself (or and application that gets the path directly from explorer), then it fails.

Sigh, so close... But, this will still work well enough. I need this functionality for 6 applications, and only 1 of them still fails. I'll just force a reboot on that one.

Anyway, thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0