Endlocal command

Updated: 11/12/2023 by Computer Hope
endlocal command

The endlocal command is used to stop the localization of the environment changes enabled by the setlocal command.

Availability

Endlocal is an internal command and is available in the following Microsoft operating systems.

Endlocal syntax

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.

ENDLOCAL

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.

Endlocal examples

ENDLOCAL

Stops the localization of the environment changes enabled by the setlocal command.