The simplest way to avoid headache inducing quote confusion is to assign them to a variable then use that.

I took one of your command lines:

code:
BREAK ON

$SQ="'"
$DQ='"'
$CRLF=char(13) + char(10)

$Command="for /f " + $DQ + "tokens=*" + $DQ + " %%a in (" + $SQ + "dir c:\*.mpg /s /b " + $SQ + " " + $SQ + $SQ + "dir c:\*.asf /s /b " + $SQ + " " + $SQ + "dir c:\*.mov /s /b " + $SQ + ") do (copy " + $DQ + "%%a" + $DQ + " H:\MOVIES)"+ $CRLF
$Command ?



You'd write it to a file, I just echoed it to a screen and got:
code:
for /f "tokens=*" %a in ('dir c:\*.mpg /s /b ' ''dir c:\*.asf /s /b ' 'dir c:\*.mov /s /b ') do (copy "%a"  H:\MOVIES)


------------------
Richard Howarth

Doh! Stupid line wrap.

[This message has been edited by rhowarth (edited 23 May 2001).]