I set up a simple batch file in windows to create a file that lists the names of all files in a folder. I added it to the action list for folders so I can run this on any folder at any time. Here is the code from my batch file: Code: @echo off dir %1 /-p /b /o:gn >File-List.txt exit Is there any way that I can add the folder name to the beginning of the created file name? IE if I run this on a folder "Downloads" the resulting file name would be "Downloads-File-List.txt" I use this forum for everything else, so I hope someone can help. Or if someone knows a better forum to post this type of question please let me know.
I'm no expert but I don't think it's possible to do what you want with a simple batch file, it'll probably require writing a vb script.
It's easy but I can't remember exactly how.. you need to get the directory name, and assign it to $dir_name.. then cd to the working directory, run your batchfile and output >$dir_name File-List.txt or have I got confused with C++ ?? It's been a really long time since I did and dos batchfile stuff... There are books and guides all over the place about dos batchfile functions.. I do know you don't need anything like visual basic to do this... because we were doing it long before there was such a thing.
The challenge though is that he added it to his "action menu" which I believe he means when he right clicks on a folder he wants to run it from there. Last I remembered there wasn't too much right clicking going on in DOS
I am trying to do this by just running the batch file. I am assuming that any dos commands would just need to be added to this .bat file. I only added it to the action menu to make it simpler.
You can use the variable %CD% to get the current path. http://www.jsifaq.com/SF/Tips/Tip.aspx?id=8782
Thanks seb32! That link and another tip on that site got me part of the way. I started tweaking some of the code they had and figured out that it was easier than I thought. All I had to do was replace File-List with %1 and it worked. Here is the new code. Code: @echo off dir %1 /-p /b /o:gn >%1%.txt exit Now all I have to do is right click on a folder and use the action, "Create File List", that I created and I get a .txt file that lists all the files that are in that folder. Man, I love this site. Even if you don't get the exact answer you need someone is bound to get you close. Thanks again everyone who replied, and everyone who ever has helped someone on this site.