Randomly generated file names
Posted: 19 Jul 2010 02:47
Hey. I've been trying to make a program that will automatically rename an executable that my school banned...
I have the following code:
Whenever I try to run it, where the old name should be, it's blank. This means that it didn't load the contents of 'oldname.txt' properly. I've got no idea how to do this without a 'for' loop, which I find can be complicated etc, etc...
I could ramble on for ages, but I'll keep the dots there
Please help!!
Thanks!!
I have the following code:
Code: Select all
@echo off
set "oldname=<oldname.txt"
set "rand=%random%"
echo.
echo OK! Let's get %oldname% a new name!
echo.
echo The new name will be '%rand%'
echo.
rename %oldname%.exe %rand%.exe
echo %rand%>oldname.txt
pause
Whenever I try to run it, where the old name should be, it's blank. This means that it didn't load the contents of 'oldname.txt' properly. I've got no idea how to do this without a 'for' loop, which I find can be complicated etc, etc...
I could ramble on for ages, but I'll keep the dots there
Please help!!
Thanks!!