The endlocal command is used to stop the localization of the environment changes enabled by the setlocal command.
Endlocal is an internal command and is available in the following Microsoft operating systems.
Ends localization of environment changes in a batch file. Environment changes made after ENDLOCAL is issued are not local to the batch file; the previous settings are not restored on termination of the batch file.
If Command Extensions are enabled, ENDLOCAL changes as follows:
If the corresponding SETLOCAL enable or disable command extensions using the new ENABLEEXTENSIONS or DISABLEEXTENSIONS options, then after the ENDLOCAL, the enabled/disabled state of command extensions are restored to what they were before the matching SETLOCAL command execution.
Stops the localization of the environment changes enabled by the setlocal command.