Sign in with
Sign up | Sign in
Your question

Batch file help

  • Configuration
  • Windows 7
Last response: in Windows 7
July 2, 2012 1:50:25 PM

ok i dont know if this is the right place to post this but anyways...

Warning : the following is a little complicated and slightly crazy (read slowly)

I have a file, say 'config.txt' in a random location. (don't worry bout the location yet)

There is a folder, say 'C:\Destination'
Now, within 'Destination' there is a single folder whose name i cannot get. And within that folder is a file - 'config.txt' ( same name as the file i have)

Heres how that looks,


Remember when i said the 'config.txt' file I have is in a random location somewhere else? Well, I wish to write a batch file in the same location as this file to do the following.

> Copy the file 'config.txt' I have, into the "unknown folder" overwriting the existing 'config.txt' if it exists.

The problems Im facing:
1. I don't know the name of the unknown folder, but i know its location.
2. The 'config.txt' file I have can be located anywhere. So i want the batch file (which will be in the same location as the config.txt i have) to copy the file from the CURRENT DIRECTORY.

The help i need:
1. I need someone to tell me what I should write to get my result. :(  (because all that i tried did NOT work.)

Hopefully, someone can help with this big challenge :( 

More about : batch file

July 13, 2012 8:12:50 AM

i figured out another method (kinda stupid) but it works.....used a for loop to copy the config.txt to every single subfolder within 'Destination' ... as there is only one subfolder, not much problems :)