ASSIGN A GLOBAL VARIABLE WITH THE SET COMMAND

The SET command only carries variables from the current MS-DOS prompt session. This means that variables created in batch files during the morning are lost when a completely separate batch file is run later that day.

Fortunately, the Winset.exe utility within the Windows 98 Resource Kit can help. Winset.exe lets you assign a variable that's set globally for the OS until the system is restarted. Here's how:


Open an MS-DOS prompt window and type set testvar=c:\windows.


Type set. The variables will be listed, including testvar. Leave that window open and start another MS-DOS prompt window.


Type set, and within the displayed list of variables, you'll no longer see testvar.

If you repeat this exercise but type winset testvar2=c:\windows, the opposite will happen. The testvar2 variable will not appear in the first MS-DOS prompt but will appear if you open a second MS-DOS prompt.

To set a variable for both the current MS-DOS prompt session and globally, remember to use both statements:

set testvar=c:\windows

winset testvar=c:\windows