Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Please read this screenshot:

screenshot

I wanted to have a list of files in variable for later reuse, but unexpectedly I get duplicate files and literal "delayed variable expansion" !variable!.

Why, or how to have a list of files in variable, w/o complicating too much?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

That extra !seq! in the beginning is what seems to be causing the duplication of the list, so chopping it off should do the trick. Use the following sequence of commands:

set seq=
for %f in (*.png) do @set seq=!seq! %f
set seq=%seq:~6%
echo %seq%

Some useful links: String Edit/Replace, Substring Extraction

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.