noprogrammer wrote:After that I got caught in the
:build_filename sub, even after replacing
Code: Select all
For /f "tokens=1 delims=:" %%a In ('findstr /N "^^" !wordlist!') Do Set num_words=%%a
by the line
Code: Select all
For /f "tokens=2 delims=:" %%a In ('find /c /v "" !wordlist!') Do Set/a num_words=%%a
I assume parsing of the wordlist file fails...
A guess: It should be within the
For /l %%a In (0, 1, !num_namewords!) loop, right after the
Set/a line..
(As for the wordlist, I grabbed a dic file with 1382512 lines having 1 word each.)
The code above is fully functional, i have tested it.
I'm not sure, why you have replaced the above line, but you should note, that this line does NOT initialize the wordlist,
it just computes the number of lines (words) that the wordlist holds:
The 'findstring /N "^^" wordlist' Searches for the "start of line" and passes the numbered lines with the format "N: text"
to the command line parser (CLP). Because of "tokens=1 delims=:" the CLP grabs the first token, that ends with a colon
(excluded) and sets %%a to the line number, which is then stored to num_words.
The lst entry stays, so when the for loop finished num_words contains the numbers of lines/words in the wordlist dictionary.
I've lazy programmed it, to see the bash script shimmering through easily.
So i didn't initiate the variable num_words to 0, as you also have other problems, if the dictionary is empty.
I also didn't any optimiziation the bash code (expect for the sha512, and set variables to random parts) as posted above:
For example especially
this variable (num_words) only needs to be initiated once, and not ten thousands of times.
Its all the same for the words in the wordlist... .
But as assumed, the slow speed of the batch is not the problem, as creating of the randomfiles is the time dominating part.
noprogrammer wrote:By the way, I noticed your script lacks "enableExtensions". Did you do that on purpose?
I had to add it trying to run subs like :do_a_file ...
In all windows versions the extensions should be enabled by default, except in protected mode, and when installing.
I assumed you don't wanted to use it in such cases.
If your admin has disabled it by default, just add it to the second line, and check if they've been enabled,
or if the enabling is also disabled, but i doubt that, but if, you have to revise the code.
noprogrammer wrote:I haven't used your C# example yet, but it might be something like
with the !filesize! option similar to rdfc.
Yes, in this example it creates a file named "!filename!" with !filesize! bytes and a full random content.
penpen