Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please read this 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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .