A
A
Anton2019-07-20 15:23:46
System administration
Anton, 2019-07-20 15:23:46

How to register a batch file that writes ip and time to a text file?

Tell me how to register in a bat file so that I can write ip (the one on 2ip.ru) and the date into the textbox, for example:
80.114.23.23 20.07.19

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
akelsey, 2019-07-20
@akelsey

Basically cmd? Fundamentally 2ip?
On PS you can:

((Invoke-WebRequest -Uri checkip.dyndns.org).Content -match "(\d+\.\d+\.\d+\.\d+)")
$ip = $matches[0]
$dt = Get-Date -f dd.MM.yy
"$ip $dt" | Out-File -FilePath $env:TEMP\status.txt -Append

K
Konstantin Tsvetkov, 2019-07-20
@tsklab

You can do this (as Saboteur already answered ):

ip (тот что на 2ip.ru)
Парсить.
дату и время
%date% %time%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question