batch scripting - parsing a file content

Discussion in 'Software' started by Sanders_2503, Oct 5, 2011.

  1. Sanders_2503

    Sanders_2503 Private E-2

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

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

    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.

    Thanks for your time - appreciate it.

    Sanders.
     
  2. GermanOne

    GermanOne Guest

    The FOR loop has to be written in a single line ...
    Code:
    FOR /F "tokens=1,2,4 skip=7" %%A in (C:\list_of_psa_files.txt) DO echo %%A %%B %%C
    
    ...or in a block ...
    Code:
    FOR /F "tokens=1,2,4 skip=7" %%A in (C:\list_of_psa_files.txt) DO (
      echo %%A %%B %%C
    )
    
    Regards
    GermanOne
     
  3. Sanders_2503

    Sanders_2503 Private E-2

    Thanks GermanOne. This works!!
    Appreciate your response.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds