I am writing a batch file and I want it to find and replace a particular file.
I don't nessarily know where the file is.
So what I want to do is take the output from:
dir /s /b myfile.dat
and use it in:
for %%i in (theoutput) do copy mynewfile.dat %%i
But I cant figure out how to get the list into the for loop.
Ive tried
for %%i in (dir /s /b myfile.dat) do copy mynewfile.dat %%i
dir /s /b myfile.dat || for %%i in (%%1) do copy mynewfile.dat %%i
etc.
It seem like it should be simple.
But it's got me frustrated![Ermm](http://murc.ws/core/images/smilies/ermm.gif)
Thanks,
Chuck
I don't nessarily know where the file is.
So what I want to do is take the output from:
dir /s /b myfile.dat
and use it in:
for %%i in (theoutput) do copy mynewfile.dat %%i
But I cant figure out how to get the list into the for loop.
Ive tried
for %%i in (dir /s /b myfile.dat) do copy mynewfile.dat %%i
dir /s /b myfile.dat || for %%i in (%%1) do copy mynewfile.dat %%i
etc.
It seem like it should be simple.
But it's got me frustrated
![Ermm](http://murc.ws/core/images/smilies/ermm.gif)
Thanks,
Chuck
Comment