I haven't done DOS in forever and can't recall the idiosyncracies with prefixing labels with %. I'm trying to write a script (others may also find it useful) to connect to ADB to a WiFi service running on my tablet.
@echo off
set def=192.168.1.21
if "%1" == "" (
echo.Please supply the IP address of the ADB server/tablet.
set /p ip=[%def%]
if %ip% == "" (
set ip=%def%
)
) else (
set ip=%1
"C:\Program Files\adt-bundle-windows-x86_64-20130219\sdk\platform-tools\adb" connect "%ip":5555
)
The script should accept an IP address on the commandline, but if none is supplied, if should prompt the operator. If nothing is entered, the printed, square bracketed default should be used.
It seems to work, except that
set ip=%def%
never executes. I think I messed up the second IF statement. I just can't get the % signs in the right place!! Does anyone remember this old black magic?
Thanks.