Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get IP address from IPConfig, use later in code, or save [closed]

Is it possible to run a code that searches IPConfig for the IP address then saves that to a text document or enters it into the prompt? I want to be able to plug my flash drive into a computer, run said batch file and either use that IP address or save it.

like image 254
JShoe Avatar asked Nov 29 '25 15:11

JShoe


1 Answers

FULL code

@ECHO OFF
ECHO.


FOR /F "TOKENS=2* DELIMS=:" %%A IN ('IPCONFIG ^| FIND "IPv4"') DO FOR %%B IN (%%A) DO SET IPADDR=%%B
ECHO %IPADDR% > file.txt



:End

The previous code will store your local ip into file.txt

like image 130
ultifinitus Avatar answered Dec 01 '25 04:12

ultifinitus