batch to search for filename and set to varia

Microsoft Windows 7 home premium
August 5, 2010 at 14:47:48
Specs: Windows 7, 4GB RAM.
I am trying to make a batch file to find Example.txt in C:\WEX or its subdirectories, then set it to a variable so I can show the txt file in batch using Echo <

How can I do this?

Also, id like help (if possible) for having a batch also search for foldernames? (within a subdirectory, again)
For example, maybe find the folder called Exa and set it to a variable so I can copy it to somewhere else.

EDIT: Sorry, wrong posting category..

See More: batch to search for filename and set to varia

Report •

August 5, 2010 at 18:03:49
What are the contents of the file? Is there a part of the name that we can use? Anything at all?

We need more information then that... You can't just think of a text file and have the batch pick it out...



Report •

August 5, 2010 at 22:33:13
I would like it to search and find "Readme.txt" from C:\Tempwat and/or any of its subdirectories. Then add the file (should be only one) to a variable so it can be toyed with (deleted, copied, etc)

Then for a folder, id like it to search for Data. From the same directories as the file. And id also like the folder to be added to a variable.

Sorry lol, didnt know what else I could put down info wise.

I am making a batch, that you can toss some game mods into it, and itll unrar the contents, then in the rar there should (but may not) be a readme.txt
I want the batch to find the readme.txt, show it, MAYBE move and rename it (but I can do that myself if I can get the filename into a variable)

Then, in each RAR there will be a data folder in the root directory of the rar, or in a subdirectory, I want the batch to find that, and copy it somewhere.

Report •

August 6, 2010 at 12:35:15
SETLOCAL EnableDelayedExpansion

DIR /b /s "C:\Tempwat">TempFile1.txt

FOR /f %%b IN ('FIND /i "readme" TempFile1.txt') DO (
	SET File=%%b
DEL TempFile1.txt
ECHO %File%

Hope I'm able to help hehe, let me know!

Report •

Related Solutions

Ask Question