3
My files are AAAAAAA-01.pdf , BBBBBB-02.pdf, CCCCCCC-03.pdf I was able to generate an excel list of file name in the folder without the extension using this command below:
for %%i in (*.pdf) do @echo %%~ni >> C:\LIST.xls
How do I have it get the first 7 characters of the file? I want the out put list of just AAAAAA , BBBBBBB, CCCCCCC , ...
My second questions is: How do I only get those characters before the DASH - ? For example my files are ABCD-01.pdf , A-03.pdf, AB-00.pdf, ... I want the output to be ABCD , A, AB, ...
I found this set first7=%%I:~0,7%
but don't know how to get it to work.
Thanks in advance for your help
You can always import the whole name into Excel then convert the data using excel formulas. That is almost always my pref. Example: import your list to column A, make column B something like
=LEFT(A1,7)
and copy it down the column, then hide Column A – Tyson – 2015-06-19T16:39:33.983I am running this in a BATCH FILE and schedule it to run multiple times a day. I have other excel file pull data from this output list using vlookup. I don't want to open the output list and have it generate 7 characters everytime. – Chaunghian – 2015-06-19T16:47:26.503