I want to make a batch file that copies *.inf files in hard disc to my pen drive on autorun?

StackOverflow https://stackoverflow.com/questions/22157445

  •  19-10-2022
  •  | 
  •  

Today I was trying to create a batch file which up on execution, searches my d drive for inf files and copies them to my pen-drive files folder. I was trying this code:

for /r "d:\" %i in (*.inf) do copy /y  "%~fi" "\files"

How to put it in a batch file and automate it...

没有正确的解决方案

其他提示

Double the percent characters %% on for loop variables when in a batch script.

for /r "d:\" %%i in (*.inf) do copy /y "%%~fi" "\files"

Recommended for speed:

xcopy D:\*.inf "\files" /S /I /Y

Note The source and target drive cannot be the same for the xcopy method.

Or

for /f "delims=" %%A in ('dir /a-d/b/s D:\*.inf') do copy /y "%%~fA" "\files"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top