What are these lines of batch code for?
<p>I came across the following batch code on SuperUser, the purpose of which is to programmatically replace a folder's icon. </p>

<pre><code>CD "%userprofile%\desktop"
MKDIR "TEST FOLDER"
ATTRIB +s "TEST FOLDER"
CD "TEST FOLDER"
COPY /Y "%userprofile%\desktop\image.ico" "./image.ico"
ECHO [.ShellClassInfo] &gt;&gt; desktop.txt
ECHO ConfirmFileOp=0 &gt;&gt; desktop.txt
ECHO NoSharing=1 &gt;&gt; desktop.txt
ECHO IconFile=image.ico &gt;&gt; desktop.txt
ECHO IconIndex=0 &gt;&gt; desktop.txt
ECHO InfoTip= &gt;&gt; desktop.txt
CHCP 1252 &gt;NUL
CMD.EXE /D /A /C (SET/P=ÿþ)&lt;NUL &gt; desktop.ini 2&gt;NUL
CMD.EXE /D /U /C TYPE desktop.txt &gt;&gt; desktop.ini
DEL /F /Q desktop.txt
ATTRIB +S +H desktop.ini image.ico
</code></pre>

<p>I get the rest of the script easily enough, but I'm having trouble understanding these three lines:</p>

<pre><code>CHCP 1252 &gt;NUL
CMD.EXE /D /A /C (SET/P=ÿþ)&lt;NUL &gt; desktop.ini 2&gt;NUL
CMD.EXE /D /U /C TYPE desktop.txt &gt;&gt; desktop.ini
</code></pre>

<p>SS64 tells me <code>chcp 1252</code> is related to something called a <a href="http://ss64.com/nt/chcp.html" rel="noreferrer">"code page"</a>, 1252 corresponding to "West European Latin", so my best guess is that this forces the script to use a Latin character set. The second two lines open instances of CMD; <a href="http://ss64.com/nt/cmd.html" rel="noreferrer">SS64</a> says the /A switch on the first makes it output in ANSI while the /U on the second makes it output Unicode. That's about as much as I can speculate on, and I'd really appreciate it if someone could go through each major part of these three lines and tell me what they're doing.</p>

<p>Thanks!</p>