Endlocal command in Windows

The endlocal command ends the localization of the environment changes in a batch file, and restores the environment variables to their original values ​​before the corresponding setlocal command is run.

For an example of how to use this command, please see the example below.

Endlocal command syntax

 endlocal 

Parameters

Parameter Description /? Show help at the command prompt.

Note

  1. The endlocal command has no effect outside the script or batch file.
  2. There is an implicit endlocal command at the end of each batch file.
  3. If the command extensions are enabled (command extensions are enabled by default), the endlocal command restores the state of the command extensions (that is, enabled or disabled) becomes the state before the corresponding setlocal command is run.

Note:

For more information on how to enable and disable command extensions, refer to the article about the Cmd command in Windows.

For example

You can localize environment variables in a batch file. For example, the following command line starts the super-application batch program on the network, passes the output to a file and displays that file in Notepad:

 @echo off setlocal path=g:programssuperapp;%path% call superapp>c:superapp.out endlocal start notepad c:superapp.out 

See more:

  1. The echo command in Windows
  2. Edit command in Windows
  3. Driverquery command in Windows
4 ★ | 1 Vote

May be interested

  • Rem command in WindowsRem command in Windows
    the rem command helps write comments (comments) in a batch file or config.sys.
  • Instructions for using Command PromptInstructions for using Command Prompt
    deep in windows is a command-line world that is obscure. in this article, we will show you how to solve errors and make your computer more secure.
  • Rd command in WindowsRd command in Windows
    the rd command helps delete a directory
  • Cmd command in WindowsCmd command in Windows
    the cmd command starts a new version of the command interpreter, cmd.exe. if used without parameters, cmd will display copyright information and the version of the operating system.
  • How to use the command history function in Command PromptHow to use the command history function in Command Prompt
    command prompt is an extremely familiar command for anyone using windows operating system. besides, a lot of current software also supports the command line to perform actions on the command prompt window, instead of on the screen.
  • The sfc command in WindowsThe sfc command in Windows
    (applies to windows server (semi-annual channel), windows server 2016, windows server 2012 r2, windows server 2012)
  • Reg command copy in WindowsReg command copy in Windows
    to copy an entry to the location specified on the local pc or the remote computer we will use the reg copy command. to learn more about how to use the reg copy command, you can track the syntax, explain the command parameters and the example tipsmake.com has compiled below.
  • Fc command in WindowsFc command in Windows
    the fc command compares two files or a collection of files and displays the differences between them.
  • The echo command in WindowsThe echo command in Windows
    the echo command displays the message or turns on / off the command repeat feature. if used without parameters, the echo command will display the current echo setting.
  • Xcopy command in WindowsXcopy command in Windows
    the xcopy command is a command prompt command used to copy one or more files or folders from one location to another. with many options and the ability to copy entire directories, the xcopy command is similar to, but much more powerful, than the copy command.