1.

Solve : Grabbing the directory name...?

Answer»

I'm writing a batch file that will copy a certain file into every sub-folder of a PARTICULAR folder. Here's what I have, but I'm not sure how to complete it:

For /f %%a in ( ) do (
SET Folder=%%a
Copy C:\Files\File.txt C:\Directory\%Folder&\
)

I'm not sure what to put in PLACE of "( )" that will get the folder name and then DROP it into the variable "Folder" for me. Any help is appreciated.
Thanks! In DOS and a batch program I believe
Code: [Select]%cd%Is the environment variable for the current folder?Figured it out:

C:
CD C:\Directory
For /D %%a in (*) do XCopy C:\Files\File.txt C:\Directory\%%a /y


Thanks



Discussion

No Comment Found