Sanders_2503 Posted October 6, 2011 Report Share Posted October 6, 2011 I have a batch script which is supposed to parse a file with file names and timestamps in it.:MAINSETLOCAL EnableDelayedExpansionFOR /F "tokens=1,2,4 skip=7" %%A in (C:\list_of_psa_files.txt) DO@echo %%A %%B %%C The file C:\list_of_psa_files.txt has the following data in it Volume in drive C is Windows XP 6.6Volume Serial Number is AC12-84AADirectory of C:\Test10/05/2011 03:17 PM <DIR> .10/05/2011 03:17 PM <DIR> ..10/05/2011 01:21 PM 4,393 1-16332-1008261.psa10/05/2011 01:21 PM 4,863 1-16332-1011698.psa10/05/2011 01:21 PM 4,793 1-16332-1023151.psa10/05/2011 01:21 PM 4,916 1-16332-1035695.psa10/05/2011 01:21 PM 4,524 1-16332-1037029.psa10/05/2011 01:21 PM 4,235 1-16332-1049340.psa10/05/2011 01:21 PM 3,135 1-16332-1049926.psa10/05/2011 01:21 PM 4,657 1-16332-1054756.psa However, when I am running my script it is failing with a message invalid syntax. Can somebody please help me figure out where am I going wrong. All I wanted to do is to get a new file with only the Date, time and the filenames(without the .psa extension on it). Thanks for your time - appreciate it. Sanders. Quote Link to comment Share on other sites More sharing options...
AceInfinity Posted January 29, 2012 Report Share Posted January 29, 2012 For one thing you're missing a bracket to define the DO part of the script. Here's an example for you :)@echo offSETLOCAL EnableDelayedExpansionFOR /F "tokens=1,2,4 skip=7" %%A in (list_of_psa_files.txt) DO ( echo %%B %%A %%C)pause Quote Link to comment Share on other sites More sharing options...
MANEMAN Posted January 29, 2012 Report Share Posted January 29, 2012 You would probably be better off sending a PM to this poster. The post is very old now, and I doubt anyone else would be that interested. John. Quote Link to comment Share on other sites More sharing options...
AceInfinity Posted January 29, 2012 Report Share Posted January 29, 2012 It belongs in a thread though in my opinion. This is WindowsForum, not WindowsPM. But for anyone who had viewed this thread in the past and didn't find an answer, perhaps they would be interested in the answer I posted. :) Quote Link to comment Share on other sites More sharing options...
MANEMAN Posted January 29, 2012 Report Share Posted January 29, 2012 I'm sure we all will. Thank you. I thought that you would have been primarily interested in the poster, and was pointing out that if there was no reply back you may have wished to contact by PM to have at least satisfied your own ego and the posters query. Quote Link to comment Share on other sites More sharing options...
AceInfinity Posted January 29, 2012 Report Share Posted January 29, 2012 I'm sure we all will. Thank you. I thought that you would have been primarily interested in the poster, and was pointing out that if there was no reply back you may have wished to contact by PM to have at least satisfied your own ego and the posters query. I just post wherever I have something to say lol Quote Link to comment Share on other sites More sharing options...
MANEMAN Posted January 29, 2012 Report Share Posted January 29, 2012 And under several different names, both asking and answering the questions set up over a period of time ? lol :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.