|Apart from simple scripts launching programs, never used a batch file for the following so please bear with me!|
Have a directory full of csv files.
I want to use the file name for field1 and then copy the contents of fields 6>11 to fields 3>8. Repeat for all so that the information from X files is held in 1 file that I can import to a db.
Currently the following works BUT I am failing miserably with using a variable for the filename,
@echo off > t1.txt
FOR /F %%a IN ('dir /b *.csv') DO call :s_sub %%a
FOR /F "tokens=2,4 delims=, " %%b IN ("test,Print1,blank,Print2") DO echo %%~na, %%b, %%c >> t1.txt
This works, but when I change ...IN ("test,Print1,blank,Print2") DO... to ...IN (!%%a!) DO... it fails spectacularly!
Any help gratefully received.
(PS before anyone asks, field2 will be "RepDate" which will be found using FIND, though that is a bridge I will cross if this is doable!)