ENDLOCAL

Makes batch file environment changes global.

ENDLOCAL

This command cancels the effects of SETLOCALSETLOCAL for subsequent commands. If a previous SETLOCAL command had command extensions enabled or disabled, ENDLOCAL will restore the state prior to the related SETLOCAL command.

Example: The following is a batch file, called from the command line:

setlocal
set omg=omd
endlocal
set wth=fuuuuu

Upon completion, the environment variable omg will be deleted (or restored to its previous value, if it had one), while the environment variable wth will be preserved.

Comments