cmd - Is there a reason to enclose a Windows batch file set command in quotes? -


i've programmed windows batch files long windows has been around , i've typically used:

set counter=0

however, i've been reviewing legacy batch file , has:

set "counter=0"

i know legal syntax according ss64.cmd there other benefits? 1 mentioned on ss64.cmd don't caught out invisible trailing spaces.

as indicate

           v there space here set  data=0  set "data=0"         avoid spaces @ end of variable 

but also

set data=^<^<^>^> set "data=<<>>"      include special characters without having escape them 

which can solve things

c:\tests\cloak & dagger files>set folder=%cd% "dagger"  not recognized internal or external command,  operable program or batch file  c:\tests\cloak & dagger files>set "folder=%cd%"  c:\tests\cloak & dagger files>set folder folder=c:\tests\cloak & dagger files 

Comments