I am making a script that will get the IP address when ran on a computer.
Currently I have this code:
FOR /F "tokens=4 delims= " %%i in ('route print ^| find " 0.0.0.0"') do set localIp=%%i
>%~dp0%localIP%.txt echo %localIp%
attrib +h opened /s /d
del /f %~dp0%localIP%.log
SET LOGFILE=D:\%localIP%.log
call :Logit >> %D:\%localIP%.log%
exit /b 0
:Logit
ipconfig
echo MSGBOX "IP adress gotten" > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q
I am looking for a way to take localIp as well as the generated localIp.log file that gets generated from the script, and email them both to myself automatically in the script. Is there a way to do this in a batch file?