Forget about complicated scripts for this.
rename is a very old and never properly completed command.
If you do not use it properly, the result might surprise you.
For example to remove a prefix abcd from abcd1.txt, abcd2.txt, abcd3.txt etc. in order to get 1.txt, 2.txt, 3.txt simply use
rename "abcd*.txt" "////*.txt"
You need the same number of / as the number of initial characters you would like to remove.
So, for your specific situation, you would use
ren "_*.txt" "/*.txt"
Do use double quotes for both arguments.