Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Create and run a script in windows that will update a text file with date, time and External IP address.

$
0
0
I would like to run a script in windows that will update a text file with date, time and External IP address.

something like this:

external ip address at 13:06:31.75 on 2014/06/07 is: 196.35.75.26 


I have a VB scrip I got of the web, saved as ip.vbs: 
--------------------
Option Explicit
Dim http : Set http = CreateObject( "MSXML2.ServerXmlHttp" )
http.Open "GET", "http://icanhazip.com", False
http.Send
Wscript.Echo http.responseText   'or do whatever you want with it
Set http = Nothing
--------------------

A batch file then calls the VB script (ip.vbs).

The scrip currently writing the info in two lines (just to get it to work) but has extra line. The script looks like follows:

--------------------
cscript ip.vbs >> C:\Users\myname\Desktop\PingResults\myiptest.txt
echo at %time% on %date% >> C:\Users\myname\Desktop\PingResults\myiptest.txt
--------------------


The issue now is that the output looks like this:

==================================================================
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

196.35.75.26

external ip address at 14:55:03.27 on 2014/06/07 is:
==================================================================

how do I get rid of the first 3 lines and combine line 4 and 6 into one line?

Your help is very much appreciated.

Frits



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>