Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6662321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:22:38+00:00 2026-05-26T02:22:38+00:00

I have a batch script which is supposed to parse a file with file

  • 0

I have a batch script which is supposed to parse a file with file names and timestamps in it.

:MAIN

SETLOCAL EnableDelayedExpansion

FOR /F "tokens=1,2,4 skip=7" %%A in (C:\list_of_psa_files.txt) DO
@echo %%A %%B %%C 

exit

The file C:\list_of_psa_files.txt has the following data in it

Volume in drive C is Windows XP 6.6
Volume Serial Number is AC12-84AA

Directory of C:\Test

10/05/2011 03:17 PM <DIR> .
10/05/2011 03:17 PM <DIR> ..
10/05/2011 01:21 PM 4,393 1-16332-1008261.psa
10/05/2011 01:21 PM 4,863 1-16332-1011698.psa
10/05/2011 01:21 PM 4,793 1-16332-1023151.psa
10/05/2011 01:21 PM 4,916 1-16332-1035695.psa
10/05/2011 01:21 PM 4,524 1-16332-1037029.psa
10/05/2011 01:21 PM 4,235 1-16332-1049340.psa
10/05/2011 01:21 PM 3,135 1-16332-1049926.psa
10/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 am trying to do is to get the date, time and the filename without the extension written to a new file from my old file.

Thanks for your time – appreciate it.

Sanders.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:22:38+00:00Added an answer on May 26, 2026 at 2:22 am

    If you really have your echo on a separate line (and it’s not an artefact of the editing process), you can’t do that. You will need to use either one line or:

    FOR /F "tokens=1,2,4 skip=7" %%A in (C:\list_of_psa_files.txt) DO (
        @echo %%A %%B %%C 
    )
    

    When I create the file and script you show, I get:

    The syntax of the command is incorrect.
    

    When I then change it to my suggested variant, it outputs:

    10/05/2011 01:21 4,393
    10/05/2011 01:21 4,863
    10/05/2011 01:21 4,793
    10/05/2011 01:21 4,916
    10/05/2011 01:21 4,524
    10/05/2011 01:21 4,235
    10/05/2011 01:21 3,135
    10/05/2011 01:21 4,657
    

    as expected. The same output appears when you do it on one line with:

    FOR /F "tokens=1,2,4 skip=7" %%A in (C:\list_of_psa_files.txt) DO @echo %%A %%B %%C 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Batch file which will call a Powershell Script : BATCH FILE
I have NAnt script which as part of its project calls a batch file
I have a batch file containing a python script using the Output template> %(NAME)s
I have a Windows batch script (my.bat) which has the following line: DTBookMonitor.exe 2>&1
I have a sh/bash script that needs to call a batch file with parameters
I have a powershell script which imports data from a csv file, and then
I am writing a batch script which I wish to open a file and
I have one big batch script which sets bunch of environment variables. I want
I have made a batch script which runs a Python application. This batch script
I have a batch file which basically downloads a file from a site or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.