无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 436|回复: 13
打印 上一主题 下一主题

[求助] 哪个大佬能帮忙写一个开启或关闭BBR2的脚本?

[复制链接]
跳转到指定楼层
1#
发表于 前天 12:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
哪个大佬能帮忙写一个开启或关闭BBR2的脚本?

要求双击自动开启BBR2,再双击脚本自动检测当前状态,如果是开启就自动恢复windows初始!
小弟不才,AI写的全不是闪退就是乱码。
请大佬帮忙,谢谢了。
2#
 楼主| 发表于 前天 12:30 | 只看该作者
以下为AI写的,但是,是假检测状态。
@echo off

if exist "%temp%\tcp_state.txt" (
    set /p state=<%temp%\tcp_state.txt
) else (
    set state=default
)

if "%state%"=="bbr2" (
    echo Switching to Default...
    netsh int tcp set supplemental template=internet congestionprovider=CUBIC
    netsh int tcp set supplemental template=internetcustom congestionprovider=CUBIC
    netsh int tcp set supplemental template=Compat congestionprovider=NewReno
    netsh int tcp set supplemental template=Datacenter congestionprovider=CUBIC
    netsh int tcp set supplemental template=Datacentercustom congestionprovider=CUBIC
    echo default>%temp%\tcp_state.txt
    echo Default algorithm set
) else (
    echo Switching to BBR2...
    netsh int tcp set supplemental Template=Internet CongestionProvider=bbr2
    netsh int tcp set supplemental Template=Datacenter CongestionProvider=bbr2
    netsh int tcp set supplemental Template=Compat CongestionProvider=bbr2
    netsh int tcp set supplemental Template=DatacenterCustom CongestionProvider=bbr2
    netsh int tcp set supplemental Template=InternetCustom CongestionProvider=bbr2
    echo bbr2>%temp%\tcp_state.txt
    echo BBR2 algorithm set
)

pause

点评

助人为乐  发表于 前天 12:48

评分

参与人数 1无忧币 +5 收起 理由
yyz2191958 + 5

查看全部评分

回复

使用道具 举报

3#
发表于 前天 12:40 | 只看该作者
  1. echo off
  2. set "temp=%temp%"
  3. set "state_file=%temp%\tcp_state.txt"

  4. if exist "%state_file%" (
  5.     set /p current_state=<"%state_file%"
  6. ) else (
  7.     set current_state=default
  8. )

  9. if "%current_state%"=="bbr2" (
  10.     echo 正在切换回 Windows 默认算法...
  11.     netsh int tcp set supplemental template=internet congestionprovider=CUBIC
  12.     netsh int tcp set supplemental template=internetcustom congestionprovider=CUBIC
  13.     netsh int tcp set supplemental template=compat congestionprovider=NewReno
  14.     netsh int tcp set supplemental template=datacenter congestionprovider=CUBIC
  15.     netsh int tcp set supplemental template=datacentercustom congestionprovider=CUBIC
  16.     echo default > "%state_file%"
  17.     echo 已切换回默认算法
  18. ) else (
  19.     echo 正在启用 BBR2...
  20.     netsh int tcp set supplemental template=internet congestionprovider=bbr2
  21.     netsh int tcp set supplemental template=internetcustom congestionprovider=bbr2
  22.     netsh int tcp set supplemental template=compat congestionprovider=bbr2
  23.     netsh int tcp set supplemental template=datacenter congestionprovider=bbr2
  24.     netsh int tcp set supplemental template=datacentercustom congestionprovider=bbr2
  25.     echo bbr2 > "%state_file%"
  26.     echo BBR2 已启用
  27. )

  28. pause
复制代码



点评

谢谢热心朋友!  详情 回复 发表于 前天 13:54
多谢大佬分享!  详情 回复 发表于 前天 13:41
好人  发表于 前天 12:48

评分

参与人数 1无忧币 +5 收起 理由
yyz2191958 + 5

查看全部评分

回复

使用道具 举报

4#
发表于 前天 13:30 | 只看该作者
同求
回复

使用道具 举报

5#
发表于 前天 13:35 | 只看该作者
感谢分享的朋友
回复

使用道具 举报

6#
发表于 前天 13:41 | 只看该作者

多谢大佬分享!
回复

使用道具 举报

7#
发表于 前天 13:44 | 只看该作者
开启bbr2好像会造成Hyper-v管理器连接不上或打不开Hyper-v建立的虚拟机
也会造成Steam无法启动

点评

Windows 11轻松设置,就是说明BBR2问题  详情 回复 发表于 前天 15:37
回复

使用道具 举报

8#
发表于 前天 13:54 | 只看该作者

谢谢热心朋友!
回复

使用道具 举报

9#
发表于 前天 15:37 | 只看该作者
绿光科技 发表于 2025-12-11 13:44
开启bbr2好像会造成Hyper-v管理器连接不上或打不开Hyper-v建立的虚拟机
也会造成Steam无法启动

Windows 11轻松设置,就是说明BBR2问题
回复

使用道具 举报

10#
发表于 前天 16:22 | 只看该作者
感谢2#3#热心坛友
回复

使用道具 举报

11#
发表于 前天 20:03 | 只看该作者
学习一下
回复

使用道具 举报

12#
发表于 昨天 08:44 | 只看该作者
感谢2#3#热心坛友
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2025-12-13 06:49

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表