D
D
Dubus2019-02-02 19:02:09
cmd/bat
Dubus, 2019-02-02 19:02:09

[bat] Specify a few specific \all files - in a specified folder?

Hello. I'm sorry if this question googles in a couple of seconds, but I tried and it didn't work for me.
Please tell me how I can set a few specific ones (by name, along with the extension) or all files in a given specific folder. It is necessary for operations with these same files. Whether it's backing up or moving once an hour.
That is, for one file, the command looks like
sef "f=file.ext"
But for several?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Olgeir, 2019-02-04
@Olgeir

For the
set f=file.ext construct
, listing several files is not easy to use explicitly. You need to have a very good idea of ​​what will happen in the future with the variable name f.
If the batch file works correctly with one file, then the easiest way is to replace the
set f=file.ext line
with
set f=%~1
and call the batch file as
for /f %a in (file.ext,file2.ext,*.ext) do <bat file name> %a

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question