Quote:

works fine but with the the deleting...
/write -dl %MyVar filename.txt

you have to "join" the number to the -dl switch
/write -dl $+ %MyVar filename.txt