Created
February 7, 2020 07:39
-
-
Save sharunkumar/231edfe47380f2bce90b6f5ab9104c60 to your computer and use it in GitHub Desktop.
Windows batch file to toggle private dns setting in android via adb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal ENABLEDELAYEDEXPANSION | |
for /F %%i in ('adb shell settings get global private_dns_mode') do set dnsmode=%%i | |
for /F %%i in ('adb shell settings get global private_dns_specifier') do set dnshost=%%i | |
echo current dns setting is: !dnsmode! | |
if "!dnsmode!"=="hostname" ( | |
echo current dns host is: !dnshost! | |
echo turning off private dns... | |
adb shell settings put global private_dns_mode off | |
echo turned off private dns setting | |
) else ( | |
echo turning on private dns... | |
adb shell settings put global private_dns_mode hostname | |
echo dns set to hostname and dns host is currently !dnshost! | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment