Q:

Condensing Batch File to a Single Line

I'm programatically creating a batch file. Limitations in the language I'm using (old delphi) mean I can't write to separate lines to the .bat. So my batch has to be a single line.
I have read this and was able to condense a few of the lines. But using the double ampersands && doesn't work for some of the lines and I haven't had success with the ping pause either.
Here's where I am at...
@echo off & setlocal enableextensions&&set myfolder_=Z:\MyFolder
for /f "delims=" %%f in ('dir /o:d /a:-d /b "%myfolder_%\*.mp3"') do (set latest_=%myfolder_%\%%~nxf)
if defined latest_ (echo rem latest file "%latest_%"&xcopy "%latest_%" "Z:\MyFolder\PlayMe" /V /D /Y) else (echo No designated files found in "%myfolder_%")   
Pause

Is it possible to further reduce the lines of code to a single line so that the batch still runs?

A:

You need to include ENABLEDELAYEDEXPANSION in your setlocal and use !var! in place of %var% 

