File creation batch

April 23, 2010 at 02:36:33
Specs: Windows XP
Could anyone help me with a batch file that creates a folder (and names it perhaps from a list in notepad), takes a copy of an existing .xls and places it in the folder then renames the .xls to the (new) folder name. Obviously doesn't have to do it in that order as long as the outcome is the same!

Thanks


See More: File creation batch

Report •


#1
April 23, 2010 at 03:29:15
Not clear if "places it " means COPY or MOVE, but let's copy.

If your list of folder names is FOLDLIST.TXT and your xls is MY.XLS:

==================================
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (FOLDLIST.TXT) do (
md "%%a"
copy "my.xls" "%%a\%%a.xls"
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
April 23, 2010 at 03:50:41
That's immense, thanks.

I don't suppose there's any way you can make it enter the folder name in a cell in the excel spreadsheet?!


Report •

#3
April 23, 2010 at 05:20:49
Probably not, since it's a binary file.


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
April 25, 2010 at 06:29:33
Assuming Excel is installed on that PC, VBScript could do it.

Report •


Ask Question