It works fine, but I want to use relative paths of the batch files location, therefore wherever I put the batch file it will copy the file into all the folders in that location.
Here is my script:
Code: Select all
for /r "S:\PathnameHere\" %%i in (.) do @copy "S:\PathnameHere\Atari 7800.psd" "%%i"
I tried replacing my paths with %%~dp0 but I guess my syntax was incorrect.
Something I wanted to add too but had no clue how is that when it copies the file it renames it to the name of the folder.
So say I have File1.ext and runt he above batch when it copied File1.ext into folder "Folder1" it would rename the file to "Folder1.psd" (keeping extension)
Thanks in advance.
Edit:
I figured the rename part out
Code: Select all
for /r %%a in (*.psd) do for %%b in ("%%~dpa\.") do ren "%%~a" "%%~nxb%%~xa"
Just need relative paths part on my first code