Batch file

T

tmaxwell

I am not sure if this is the place for this question, but.......Anyway, what
I am needing to do is write a batch file that copies all the file names in a
folder and then copies them over to note pad so I can copy just the name of
the file. So in Batch Load folder there are 50 files that I need to copy just
the name to put in Excel. The way they are doing it now is right clicking and
choosing "reaname" then copy, then paste into excel. I started a batch file
named "Grab File Names" . I got as fara as @echo off, then I cannot remember
the code to write this to Notepad. Please help
Thanks
 
G

Gary''s Student

The following .bat file:

c:
cd \temp
dir *.* /b > c:\x.txt

will list the files in c:\temp in a text file called x.txt in the top-level
of c:

Then use Excel to open x.txt
 
J

Jay Freedman

I am not sure if this is the place for this question, but.......Anyway, what
I am needing to do is write a batch file that copies all the file names in a
folder and then copies them over to note pad so I can copy just the name of
the file. So in Batch Load folder there are 50 files that I need to copy just
the name to put in Excel. The way they are doing it now is right clicking and
choosing "reaname" then copy, then paste into excel. I started a batch file
named "Grab File Names" . I got as fara as @echo off, then I cannot remember
the code to write this to Notepad. Please help
Thanks

The following statements in a batch file will write the file names from the
"c:\batch load" folder into a text file, and immediately open that text file in
Excel (no need for Notepad or copy/paste). Change the folder names in the
statements as needed.

@echo off
dir "c:\batch load" /b /a-d /l > c:\temp\names.txt
start excel c:\temp\names.txt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top