I'm trying to see if I can't make a random name generator using batch scripts (For fun basically). The idea is to produce a batchfile which creates pronounceable names instead of random text strings.
While I could easily make a simple system which picks a random name from a premade list, that's boring. What I want to do is have a system which selects a variable string of syllables and strings them into a name.
That works via:
set /a roll=%random%%%100+1
if %roll% leq 100 set syllable=ah
if %roll% leq 95 set syllable=roh
and so on, with a bit at the end that checks to see if a count is equal to a certain number, and if not ads 1 tot he count and loops back to roll for another syllable. The number of syllables is chosen via a similar modified %random% and ranges from 2 to 8.
Unfortunately I am stuck at getting the multiple uses of that loop to become a single variable. I think that you can use the type command to input text to a batch file from a text file, so what I want to do is work out a way to make
echo %syllable% >> name.txt
result in a text file which has all it's entries on a single line with no spaces, instead of one entry per line.
I would also appreciate someone showing me how to use the set command to make a variable equal a text file's contents. I think it would be:
set name=< name.txt
But that may actually make the variable be "< name.txt"...