Setting an environment variable in NT using Kix32
Posted on 1998-03-12
I am using the Kix32 scripting language (comes with the NT Resource Kit) to set an environment variable in NT to today's date. The script will be run automatically by the Scheduler Service at 12:01am every day to allow the variable %today% to be used in various ways by other command scripts, batch files, etc. throughout the day.
There are three different commands to do this in Kix32. The variables are set in Current Environment (SET), Local User (SETL) and Local Machine (SETM).
I cannot get the variable to be seen in a Command Prompt started by the scheduler service. Even when I schedule an interactive command prompt (using CMD.EXE /K) and then manually run the script in that window, the variable will not show up in the current window. It will also not show up in any subsequently started "CMD.EXE /K" windows started by the Scheduler service. It will show up in the System Properties/Environment window under System Variables and User Variables and it will show up in any new Command Prompt windows started from the Start Menu.
My questions are these:
1. Is there a way to have the local system account (the one required to be used by the Scheduler Service for interactive jobs) read the current system variables if you have changed them since bootup? If not, is there a registry area that can be modified to make this happen?
2. Does anyone have another suggestion as to a method of setting environment variables in NT Scheduler command prompt windows?
3. Is there a way to auto-update other already open windows with the new environment variables when you set them?
4. Does anyone know of additional references for Kix32 on the Internet or elsewhere?