Windows bat file to rename multiple files with custom names
<p>I have multiple folders with multiple files in each of them. The file names are as following: <em>static-string</em>-1.wav <em>static-string</em>-2.wav .... <em>static-string</em>-10.wav ... <em>static-string</em>-99.wav <em>static-string</em>-100.wav ... and so on. The static string remains same but the number before .wav changes from 1 - 999. Now the problem is if I want to play this on any media player or want to join all the files, windows will sort like 1,10,100,2,20,200 not 1,2,3,4,5,6,7,8,9,10 which messes up the playback. So to fix this, I have to rename each file from <em>static-string</em>-1.wav to <em>static-string</em>-0001.wav and so on.
Currently, I am doing a dir command to an output file and then I copy the file list in excel from where I do some playing around with concatenate and text to columns and come up with two columns of old name and new name which I then again convert to a .bat file with and run it. The bat file has multiple rows with individual rename commands something like this:</p>

<hr>

<pre><code>@echo off
rename &lt;oldname1&gt; &lt;newname0001&gt;
rename &lt;oldname2&gt; &lt;newname0002&gt;
.
..
exit
</code></pre>

<hr>

<p>It is getting the work done but I know there is and easier and more efficient way to use for loops. I saw few example and previous answers but they dont have a similar requirement as me. Any help will be appreciated.</p>