FOR /F TOKENS and long filenames

July 4, 2011 at 05:15:22
Specs: Windows XP, 1.5MHz/512MB RAM
Hi, I am running Microsoft Windows XP [Version 5.1.2600]. I need to store the DIR output into a "database". For this, I need to output all the files in the current directory into a .txt file which I plan to use later to insert/update records into the database.
This is what I am doing -

@echo off
for /f "usebackq skip=5 tokens=1,2,3,5*" %%G IN (`dir /a:-d-s-h ^| findstr /vi "file(s) dir(s)"`) do echo %%G %%H %%I %%J

However, I am getting stuck with long filenames. Is there a way by which I can put token#5 and all trailing words into %J? This is my first post so do let me know if I have missed giving some information. Thanks

See More: FOR /F TOKENS and long filenames

Report •

July 4, 2011 at 05:33:38
Add %%K but you can achieve the same result by coding

for %%j in (*) do echo %%~tj %%~zj %%~nxj

Report •
Related Solutions

Ask Question