Windows Batch script * (star) read as text?
<p>I'm writing a batch script to convert a fixed-width text file to .csv format. Here's what I've written so far:</p>

<pre><code>@echo off
setlocal enabledelayedexpansion


    for /F "tokens=*" %%A in (HRV*.txt) do (
    set var=%%A
    set mer=!var:~6,11!
    set cr=!var:~18,19!

    set dt=!var:~42,30!
    set aa=!var:~72,30!
    set ab=!var:~102,30!
    set ac=!var:~132,15!

    set ad=!var:~147,30!
    set ae=!var:~177,30!

    set af=!var:~283,36!

    set ag=!var:~318,3!
    set ah=!var:~329,7!
    set ai=!var:~337,17!
    set aj=!var:~442,2!
    set ak=!var:~460,15!
    set al=!var:~475,2!
    set am=!var:~482,15!

    set y=!mer!.!cr!,"!dt!","!aa!","!ab!","!ac!","!ad!","!ae!",="!af!","!ag!",="ah","ai","aj",="ak","al",="am"
    echo !y!&gt;&gt; converted.csv
    )

pause
</code></pre>

<p>The problem is that when I run it, the program fails to complete, and outputs "The system cannot find the file HRV*.txt". I then changed for loop to</p>

<pre><code>for /F "tokens=*" %%A in (*.txt) do ( ...
</code></pre>

<p>But the error just changed to "The system cannot find the file *.txt"</p>

<p>It seems that the star * is being read as text? does this have something to do with "tokens+*"? How can I make it so that the script will run on any file that starts with HRV? </p>