<p>I am trying to rename all the files present in a Windows directory using <strong>FOR</strong> command as follows at the command prompt:</p>

<pre><code>for %1 in (*.*) do ren %1 test%1 
</code></pre>

<p>E.g. This renames a file <strong>enc1.ctl</strong> to <strong>testenc1.ctl</strong> <strong>enc2.ctl</strong>  to <strong>testenc2.ctl</strong> </p>

<p>Thats not what i want. What i want is 
<strong>enc1.ctl</strong> renamed to <strong>test1.ctl</strong>   <strong>enc2.ctl</strong> renamed to <strong>test2.ctl</strong> </p>

<p>How do i do that?</p>

<hr>

<p>@Akelunuk: 
Thanks, that w kind of works but i have files names as </p>

<p><strong>h263_enc_random_pixels_1.ctl , h263_enc_random_pixels_2.ctl</strong> which i want to rename to</p>

<p><strong>test1.ctl and test2.ctl</strong> respectively </p>

<p>Then how?</p>

If you know the number of files, (say 10), you can use
```
```
for /L %1 in (1,1,10) do ren enc%1.ctl test%1.ctl
```
```