Sorry if this seems like a simple question, but I could not find the right answer anywhere....
I have a set of files in a folder with this naming convention.... tablename_date_time.dat
I need to loop thru the folder and extract the tablename (up to the underscore) and use it in a bcp command, what would be the best way to do this?
So far I have the command, but I can't figure out the substr part.
for /f %%i in (%1) do (
bcp tablename IN C:\temp\%%i_.dat -n -T
)
Thank you for your help.