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

Variables and Parameters

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

Maximum Variables and the Drop Command

Keywords: maximum variables drop command maxvars www-prod

There are two types of memory: storage space for strings, and storage space for variables. The Drop() functions frees up both the storage space for strings and clears the variable.

Variables are dropped when the Entire WinBatch program is terminated. If you wish to drop variables sooner, use the DROP function. You may wish to drop local variables just before you exit from the subroutines. Here's an example of how to use it:

        aaa="Hello"
        bbb="World"
        Message(aaa,bbb)
        Drop(aaa,bbb)
        Message(aaa,bbb)   ; Now causes an error

Currently, our limit for variables is about 2000 variables and no limit on string spaces

Integers and floating point numbers generally do not use string space.

The Drop function was more useful in older version of WinBatch. Many of the ancient limitations have been remove and with the addition of arrays and user-defined functions (UDF's) in the 2001A version, the need for careful memory management has been greatly reduced.


Undocumented workaround for WinBatch 2011B or newer:

Maximum number variables can be set using the following registry setting. The limit will apply to both compiled and interpreted scripts. You would need to change the RegSetValue view flag to 64 for the setting to apply 64-bit scripts. The setting does not affect the variable limit in the WinBatch Studio debugger. The maximum recognized limit is 65000.

bitness = 32
If WinMetrics(-2)>2 then bitness = 64

strRegMaxVars = "SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB44I\[MaxVars]"
nMaxVars = 4000
if nMaxVars<65000 then RegSetValue( @REGMACHINE, strRegMaxVars, nMaxVars, bitness )
The default setting can be restored by deleting the 'MaxVars' value. Also remember that running the above in a script does not increase the limit for the running script.

Disclaimer: WWW is NOT responsible for any spontaneous reformatting of system hard drives nor any nuclear power plant meltdowns that may result from the use of the information contained here-in.


Article ID:   W13906
Filename:   Maximum Variables and the Drop Command.txt
File Created: 2012:03:22:07:33:06
Last Updated: 2012:03:22:07:33:06