Some_Yahoo
Some_Yahoo

Reputation: 509

DOS Batch copy over multiple files

This may be an unusual request, but I have a template ini file that I want to use to overwrite a bunch of ini files in a certain folder. Something like

copy /b/v/y template.ini *gui_settings.ini

or

copy /b/v/y template.ini < dir *gui_settings.ini /b

This does not work.

I even tried

dir *gui_settings.ini /b >files.list
copy /b/v/y template.ini < files.list

...but no dice.

Upvotes: 0

Views: 314

Answers (2)

npocmaka
npocmaka

Reputation: 57252

@echo off
setlocal enableDelayedExpansion

for %%a in (*gui_settings.ini) do (

    copy /b /y /v "%%~fa"+template.ini ~.ini
    copy /y /b /v ~.ini "%%~fa"
)
del /q /f ~.ini

Upvotes: 0

MC ND
MC ND

Reputation: 70923

for %%a in ("*gui_settings.ini") do type "template.ini" > "%%a"

For each *gui_settings.ini file found, type the template into the file

Upvotes: 2

Related Questions