I have bought an USB key that can read MP3s. Sadly, it doesn't have a "random" mode, so it's always reading music in the same order. I would like to randomize this "easily". For that, I decided to, regularly, replace each file's name by the hash of its previous file name (and append .mp3, in order not to confuse the player).
I am used to bash, not batch, but I tried a few things. Here is how far I can get:
for %f in (.\*.mp3) do for /F %i in ('echo %f | hashsum') do @echo move %f %i.mp3
A few notes :
- I couldn't find how to use batch's certutil to generate the hash of a random string, so I'm using hashsum
- This uses one % instead of two, because it's not yet in a batch script
- The second for loop comes from here
- This doesn't do what I expect. I'm getting the error that the pipe (|) was unexpected.
I'm sure I'm getting close, but two points are still obscure:
- Can't certutil help me generate the hash of a string? (without using temporary files)
- How can I pass the output of a (piped) command as the argument of another command?