utka00 Цитата: нужно в файле найти определенное число (повторяется несколько раз) и заменить его на случайно сгенерированное причем каждый раз на новое
Код: @echo off
call :sbs_create
setlocal enabledelayedexpansion
:: main section
del /q /f temp1.txt 2>nul
copy "%~1" temp1.txt>nul
:again
type temp1.txt | find " %2">nul
if %errorlevel%==0 (
call :random7
sbs2.com 1 " %2" " !rnum!" < temp1.txt > temp2.txt
del /q /f temp1.txt
ren temp2.txt temp1.txt
goto :again)
:: Delete the SBS2.COM program
del /q sbs2.com
ren "%~1" "%~1.bak"
ren temp1.txt "%~1"
goto :EOF
::end of main section
:random7
set "rest="
set /a "fdigit=(!random! %% 4) + 1"
for /l %%a in (1,1,6) do (
set "num=!random:~-1!"
set "rest=!rest!!num!")
set "rnum=!fdigit!!rest!"
goto :EOF
:sbs_create
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>"sbs2.com"
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>>"sbs2.com"
echo ?@}IKuNWpe~Fpe?FNHlF?wGMECIQqo{Ox{T?kPv@jeoSeIlRFD@{AyEKj@>>"sbs2.com"
echo iqe~1NeAyR?mHAG~BGRgB{~H?o~TsdgCYqe?HR~upkpBG?~slJBCyA?@xA>>"sbs2.com"
echo LZp{xq`Cs?H[C_vHDyB?Hos@QslFA@wQ~~x}viH}`LYNBGyA?@xAB?sUq`>>"sbs2.com"
echo LRy@PwtCYQEuFK@A~BxPtDss@fFqjVmzD@qBEOEenU?`eHHeBCMs?FExep>>"sbs2.com"
echo LHsPBGyA?@xAunjzA}EKNs@CA?wQpQpKLBHv?s`WJ`LRCYyIWMJaejCksl>>"sbs2.com"
echo H[GyFGhHBwHZjjHeoFasuFUJeHeB?OsQH[xeHCPvqFj@oq@eNc?~}Nu??O>>"sbs2.com"
echo ~oEwoAjBKs?Zp`LBzHQzyEFrAWAG{EFrAqAGYwHTECIQ{coKIsaCsf{Oe~>>"sbs2.com"
echo CK}Ayre~CNFA{rAyEKFACrA{EKGAjbA}eKGSjNMtQFtc{OAyDGFj?{FDGQ>>"sbs2.com"
echo KAjNVk_OCAx@e?f{o?CosI}1EGizhljJ~H1ZeG}JBA~rACBMDGjjDG@g0>>"sbs2.com"