Any suggestions? Export (0) Print
Expand All
Arp
At
Cd
Cls
Cmd
Del
Dir
Fc
For
Ftp
If
Ldp
Lpq
Lpr
Md
Mmc
Msg
Nlb
Rcp
Rd
Reg
Rem
Ren
Rsh
Rsm
Rss
Sc
Set
Sfc
Ver
Vol
Collapse the table of content
Expand the table of content
Expand Minimize

Endlocal

 

Updated: April 17, 2012

Applies To: Windows Vista, Windows Server 2008, Windows Server 2012, Windows 8

Ends localization of environment changes in a batch file, and restores environment variables to their values before the corresponding setlocal command was run.

For examples of how to use this command, see Examples.

endlocal

Parameter

Description

/?

Displays help at the command prompt.

  • The endlocal command has no effect outside a script or batch file.

  • There is an implicit endlocal command at the end of a batch file.

  • If command extensions are enabled (command extensions are enabled by default), the endlocal command restores the state of command extensions (that is, enabled or disabled) to what it was before the corresponding setlocal command was run.

System_CAPS_noteNote

For more information about enabling and disabling command extensions, see Cmd.

You can localize environment variables in a batch file. For example, the following program starts the superapp batch program on the network, directs the output to a file, and displays the file in Notepad:

@echo off
setlocal
path=g:\programs\superapp;%path%
call superapp>c:\superapp.out
endlocal
start notepad c:\superapp.out
Show:
© 2016 Microsoft