下面是我写的批处理, 发一下,大家根据自已的需求改一下
@echo off
mode con cols=70 lines=20
title MAC随机修改工具
color 3F
setlocal enabledelayedexpansion
set ShuaPath=C:\shua\text
:start
cls
echo. ----------------------------
echo. [1] 随机修改MAC和硬盘地址
echo. [2] 更新刷号信息
echo. ---------------------------
set /p choice= 请选择:
if "%choice%"=="1" (
cls
echo. ----------------------------
echo. 输出sd序号
echo. ---------------------------
ipconfig /all|find "Description">%ShuaPath%\des.txt
devcon find pci\*>%ShuaPath%\pci.txt
call :getPCI 1
call :getMAC 1
set /p shuaid= 序号:
echo. !shuaid!
for /f "tokens=1,4,5" %%i in (%ShuaPath%\bj.txt) do (
if "!shuaid!"=="%%i" (
call :getdiskid %%k %%i
call :getMAC 2 %%j
call :getPCI 2
call :setuserid %%i
goto :end
)
)
goto :start
)
else if "%choice%"=="2" (
del %ShuaPath% /f /q
call :updatetext
goto :start
)
goto :start
:: 1 diskid 2刷号序号
:getdiskid
for /f "skip=5 tokens=6" %%i in ('volumeId c: %1') do (
if "%%i"=="updated" (
echo 设制DiskId成功
goto :eof
) else (
echo.-----------------------------------------------
echo 设制DiskId更新失败
echo.查看%ShuaPath%\bj.txt 当序号%2是否存在 disk-id
echo.-----------------------------------------------
pause>nul
goto :start
)
)
goto :eof
:: 1选项获取MAC地址 2选项设置MAC地址
:getMAC
for /f "skip=11" %%i in ('reg query HKLM\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}') do (
for /f "skip=4 tokens=2,*" %%j in ('reg query %%i /v DriverDesc') do (
if %%k==!pci! (
if %1==1 (
for /f "skip=4 tokens=2,*" %%l in ('reg query %%i /v networkaddress') do (
set MAC=%%m
goto :eof
)
)
if %1==2 (
echo 设制MAC...
reg add %%i /v networkaddress /d %2 /f>nul
goto :eof
)
)
)
)
goto :eof
:: 1选项获取网卡信息 2重启动网卡
:getPCI
for /f "tokens=2 delims=:" %%i in (%ShuaPath%\des.txt) do (
for /f "tokens=2 delims=&" %%j in ('type "%ShuaPath%\pci.txt"^|find "%%i"') do (
if %1==1 (
set pci=%%i
set pci=!pci:~1,-1!
goto :eof
)
if %1==2 (
echo 正在禁用网卡...
devcon disable *%%j*>nul
echo 正在启用网卡...
devcon enable *%%j*>nul
goto :eof
)
)
)
goto :eof
:: 设置刷号ID
:setuserid
for /f "tokens=1,*" %%i in (%ShuaPath%\bj.txt) do (
if %1==%%i (
echo 存放使用号信息...
echo %%i %%j>>%ShuaPath%\vpn.txt
echo 删除修改MAC DISKID自启动
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v changemaxdiskid /f >nul 2>nul
echo 添加init自启动
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v BATDISPLSY /t reg_sz /d ""C:\shua\init.bat"" /f >nul 2>nul
goto :eof
)
)
goto :eof
:updatetext
rem 指定FTP用户名
set ftpUser=shua
rem 指定FTP密码
set ftpPass=cbbuknadmin
rem 指定FTP服务器地址
set ftpIP=192.168.2.4
rem 指定待下载的文件位于FTP服务器的哪个目录
set ftpFolder=/SHUA/text
rem 指定从FTP下载下来的文件存放到本机哪个目录
set LocalFolder=%ShuaPath%
set ftpFile=%ShuaPath%\TempFTP.txt
>"%ftpFile%" (
echo,%ftpUser%
echo,%ftpPass%
echo cd "%ftpFolder%"
echo lcd "%LocalFolder%"
echo bin
echo mget *.*
echo bye
)
ftp -v -i -s:"%ftpFile%" %ftpIP%
del %ftpFile%
pause1
goto :eof
:end
if exist %ShuaPath%\des.txt del %ShuaPath%\des.txt
if exist %ShuaPath%\pci.txt del %ShuaPath%\pci.txt
shutdown -r -t 00 |