找DLL电脑论坛

 找回密码
 立即注册
查看: 41|回复: 0

DNS快捷修改脚本

[复制链接]

427

主题

446

帖子

1914

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1914
发表于 2021-4-13 16:51:45 | 显示全部楼层 |阅读模式
  1. @echo off
  2. title 改DNS:输入1则将4.2.2.1设为主DNS;输入2则将223.6.6.6设为主DNS。
  3. %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
  4. echo Microsoft Windows [Version 10.0.19041.207]
  5. echo (c) 2020 Microsoft Corporation. All rights reserved.
  6. echo.
  7. echo CreateObject("Scripting.FileSystemObject").DeleteFile(WScript.ScriptFullName) >%Temp%\Wait.vbs
  8. echo wscript.sleep 1500 >>%Temp%\Wait.vbs
  9. start /wait %Temp%\Wait.vbs
  10. echo Connecting...
  11. echo CreateObject("Scripting.FileSystemObject").DeleteFile(WScript.ScriptFullName) >%Temp%\Wait.vbs
  12. echo wscript.sleep 3000 >>%Temp%\Wait.vbs
  13. start /wait %Temp%\Wait.vbs
  14. echo.

  15. :home
  16. set /p input="[guest@107.*.*.21 ~]#^C:\Users\%username%>"
  17. if "%input%"=="1" goto 4
  18. if "%input%"=="2" goto 2
  19. if "%input%"=="help" goto help
  20. if not "%input%"=="1" if not "%input%"=="2" if not "%input%"=="help" goto ex

  21. :help
  22. echo       DNS远程修改插件简介、、
  23. echo 》可以从服务器来连接本地,获取管理员权限并修改DNS的插件!
  24. echo 》本插件开源,禁止售卖!
  25. echo 》插件特点:自定义输入检测、自定义DNS、开源免费!
  26. echo 》安全易用!
  27. echo 》禁止用于商业用途!禁止用于违反国家法律的用途!
  28. goto home

  29. :4
  30. ::判断本地连接 赋值a
  31. for /f "tokens=3,4 delims== " %%i in ('ipconfig ^|findstr /r "以"') do echo %%i %%j >DNS.txt
  32. for /f "tokens=3,4 delims== " %%i in ('ipconfig ^|findstr /r "本"') do echo %%i %%j >DNS.txt
  33. for /f "tokens=1 delims==:" %%d in (DNS.txt) do set a=%%d
  34. ::dns的值
  35. echo 开始更改主dns
  36. netsh interface ip set dns name="%a%" source=static addr=4.2.2.1
  37. echo 完成!
  38. echo 开始更改副dns
  39. netsh interface ip add dns name="%a%" addr=223.6.6.6 index=2
  40. del DNS.txt
  41. echo 已将4.2.2.1设为 %a% 的主DNS!
  42. pause
  43. exit

  44. :2
  45. ::判断本地连接 赋值a
  46. for /f "tokens=3,4 delims== " %%i in ('ipconfig ^|findstr /r "以"') do echo %%i %%j >DNS.txt
  47. for /f "tokens=3,4 delims== " %%i in ('ipconfig ^|findstr /r "本"') do echo %%i %%j >DNS.txt
  48. for /f "tokens=1 delims==:" %%d in (DNS.txt) do set a=%%d
  49. ::dns的值
  50. echo 开始更改主dns
  51. netsh interface ip set dns name="%a%" source=static addr=223.6.6.6
  52. echo 完成!
  53. echo 开始更改副dns
  54. netsh interface ip add dns name="%a%" addr=4.2.2.1 index=2
  55. del DNS.txt
  56. echo 已成功将233.6.6.6设为 %a% 的主DNS!
  57. pause
  58. exit

  59. :ex
  60. echo '%input%' is not recognized as an internal or external command,
  61. echo operable program or batch file.
  62. goto home
复制代码
快速修改DNS:将代码复制,然后新建一个文件,后缀改为bat,运行即可
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|找DLL下载站

GMT+8, 2021-5-13 20:58 , Processed in 1.921863 second(s), 21 queries .

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