WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Environment

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Environment Variables in Windows 95

Keywords: environment variable 

Problem:

I'm using WinBatch under Win95 to run a DOS app that sets an environment variable. Later in the WinBatch program I want WinBatch to be able to reference this environment variable but it's not getting set. If I run the DOS app from DOS, it does set the environment variable, but it seems that WinBatch is not allowing that to happen.

Answer:

Windows is not allowing it to happen. The DOS app can only set environment variables for itself. Not for any other program.

There is a Microsoft utility that can be used to set a global DOS variable in Windows 95. The utility is called "WinSet" and it's in a self-extracting archive file named "envars.exe". It's used almost identically to the DOS Set command, except it changes the master DOS environment in Windows 95.

What are you trying to do? If you are trying to return an errorlevel to WinBatch, see ERRORLEVEL.* in the samples subdirectory.

Are you trying to return other info to WinBatch? To write info to a ini file like thusly...

  
      echo [MyData] > c:\temp\mydata.ini
      echo envvar=%envvar% >> c:\temp\mydata.ini

In WinBatch, do the following:

      envvar=IniReadPvt("MyData","envvar",0,"c:\temp\mydata.ini")
 

Article ID:   W12926
Filename:   Win95 and environment variables.txt
File Created: 1999:04:15:16:50:34
Last Updated: 1999:04:15:16:50:34