What do '=' and ';' do characters mean in a .bat file?

The following .bat file does not generate an error. Why?

@@@@@@@@@@@@@@@ ::::::::::::::: ;;;;;;;;;;;;;;; =============== =;=;=;=;=;=;=;= ;=;=;=;=;=;=;=; 

I know that the prefix of the string โ€œ@โ€ means โ€œnot an echoโ€, but the prefix :: means โ€œthis is a commentโ€, but what they do ; and = ?

As far as I can tell, you can start the line with any mixture of ';' and '=', and this has no effect. =;=;=;=;=;=dir does dir . What is the correct interpretation of '=' and ';'

+4
source share
2 answers

They are interpreted as command line delimiters (along with comma and space), so the following equivalents:

 dir c:\ /b dir c:\;/b dir c:\=/b dir c:\,/b 

In the case =;=;=;=;=;=dir they are apparently considered as the leading white space and are ignored

+4
source

Example

  ;;for;=/l=%%^^;in;,=;(;;0;=,=1,% hello% 5::@loop)=,=do;;@echo(%%^^% 
+1
source

All Articles