3

In unix, to copy a set of files, I can do something like:

cp /mydocuments/ID00{1..5}F /somewhere

what would the equivalent command in windows command line look like? I tried '(1,1,5)' instead of '{1..5}', but that doesn't seem to work.

Edit: 'Windows command line'

bsmith
  • 389
  • 2
  • 3
  • 13
  • 2
    Possible duplicate of [DOS FOR loop on range through command line](https://stackoverflow.com/questions/15577492/dos-for-loop-on-range-through-command-line) – Sneftel Dec 23 '17 at 18:14
  • Sorry, yes windows command line (now edited)! – bsmith Dec 23 '17 at 19:28

1 Answers1

4

You can use something like this:

for /l %f in (1,1,5) do copy \mydocuments\ID00%fF \somewhere

The "/l" is mandatory if you want to use range.

for /l %f in (start, step, end) do...
Rahmani
  • 857
  • 3
  • 14
  • 28
  • 1
    Thanks. Using `/l` (letter L) solved for me. On Windows 10, I executed `for /l %i in (0,5,20) do fsutil file createnew %i.file 50000` and Windows 10 did indeed create files `0.file`, `5.file`, `10.file`, `15.file` and `20.file`, each one of them with a size of 50000 bytes (i.e. 50 thousand bytes = 50 kilobytes). – Yuri Sucupira Jul 07 '22 at 18:58