Batch file help

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,

C:\Destination\<unknownfolder>\config.txt

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.

Quote:
> 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 :(
2 answers Last reply
More about batch file help
  1. Why not find the name of the folder?
    "dir" or
    "dir >>list.txt"

    Then look at list.txt to find out the name of the unknown folder.
    http://superuser.com/questions/177234/can-i-use-cmd-to-search-for-files-in-windows

    Or find the file "config.txt" with cmd prompt then pipe the result to the batch file.
  2. 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 :)
Ask a new question

Read More

Configuration Windows 7