There is a function in Win32::AdminMisc that can set the environment and broadcast the message to all windows as described below, but I'm afraid you're out of luck with the DOS windows. If you want to change the current DOS window, you can probably just manipulate the %ENV hash.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, March 21, 2003 12:59 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: AW: Control another Window Hello all, I have two answers (one from Pat and one from Yves) Thank You, both work fine :-) I set the environment into a remote computer: B U T 2 questions: 1. how can I send to this message WITHIN remote computers (using WMI if possible) ???????????? 2. (not so importantly) It does not work for an opened DOS-window --> I must close the window and I must open a new window before the new environment is effective ---> Is it possible environment also for all opened DOS-Windows to change ???????? [EMAIL PROTECTED] writes: > hello All, > > how do I make > > <Start> --> <Settings> --> <Control Panel> --> System --> Environment --> > <Alt V> --> (Variable) --> <Alt L>--> (Value) --> <Alt E> --> <Alt A> > > in perl ? ? > > I can change the variable in the registry, but I need the effect > immediately. ---------------------------------------------------------------------------- ------ To set an environment variable, I suggest using WMI. For a sample script, see: <http://unattended.sourceforge.net/apps.html#setenv> - Pat ---------------------------------------------------------------------------- ------ Answer from Dutrieux Yves: >From an old message in this list : =================================== Cruickshanks, Darin [mailto:[EMAIL PROTECTED] wrote: > Does anyone know of a way to make changes to the registry (in particular HKCU) > take effect immediately using Perl? For instance if you change the mouse > speed by modifying the appropriate keys in HKCU using Perl, the changes only > take effect after you logoff then back on. A third party utility that performed > this function would be just as useful, As Dave mentioned it is up to the application to listen for the "registry changed" message and do the appropriate thing. A method to actual send out the message for the "Environment" keys is: sub notify_windows { no strict; my $SendMessage = new Win32::API("user32", "SendMessage", [N, N, P, P], N); use strict; my $result = $SendMessage->Call(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'Environment'); print "SendMessage result: $result \n"; } This works for me on Windows 2000, to notify some CAD tools of changes to variables they care about, such as PATH. It does not update the environment as it exists in currently open cmd.exe windows, so you will have to test and see if is applicable to your situation. Unfortunately the only guaranteed method is log out/log back in, which is yet another way that Windows sucks compared to Unix. _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs