| 1. |
Solve : IP Address from File? |
|
Answer» I am attempting to pull an IP address from a file and then use that IP address later in the script for different things such as tracert and ping etc. SERVER.DB line can look like this So, are you saying that a SERVER.DB line always has SERVER.DB at the beginning, then a = sign and then you will always find the IP address? Is that right? That is a correct statement. In fact it is very easy to isolate the IP address. In your code, simply CHANGE this: "tokens=1,2 delims==" to this: "tokens=1,2 delims== " so that there are now 2 possible token delimiters, the = sign and also white space, therefore in any lines which have anything after the IP address, e.g. ;DB Files that will not be in the second token %%U Thank you Sir once again for your help. I can start a new thread for this as it is on a pretty large tangent, but basically is there a way to get the version of an application from dos? From Windows you can hover over an *exe or go to the version tab in properties, but can dos pull this information and output to a file? Telnet, I use telnet from a command PROMPT to confirm connectivity to a certain server on a certain port, if the connection fails visually on the dos prompt it will tell you, but if it works your no longer in dos, is there a way to batch this to log to a file saying telnet success or telnet failed? Then continue in the original dos prompt. I'm assuming to some DEGREE errorlevel could be used by maybe calling another bat file, but if it is successful I have no idea how to get back out of telnet to continue with the script. |
|