What does %~dp0 mean, and how does it work?

Calling for /? in the command-line gives help about this syntax (which can be used outside FOR, too, this is just the place where help can be found). In addition, substitution of FOR variable references has been enhanced. You can now use the following optional syntax: %~I – expands %I removing any surrounding quotes (“) … Read more

Where does GOTO :EOF return to?

:EOF is a predefined label as Microsoft explains in documentation for command GOTO. The help output by running in a command prompt window goto /? explains also this special label for End Of File. But this predefined label is supported only with command extensions being enabled as by default. The help output by running in … Read more

What are the undocumented features and limitations of the Windows FINDSTR command?

Preface Much of the information in this answer has been gathered based on experiments run on a Vista machine. Unless explicitly stated otherwise, I have not confirmed whether the information applies to other Windows versions. FINDSTR output The documentation never bothers to explain the output of FINDSTR. It alludes to the fact that matching lines … Read more

Why is no string output with ‘echo %var%’ after using ‘set var = text’ command in cmd? [duplicate]

Assigning a value/string to an environment variable It is best to use following syntax with command extensions enabled to define or modify an environment variable: set “var=text” The command is set and the parameter is “variable=value”. The parameter string can be enclosed in double quotes as on all commands as long as command extensions are … Read more