I need to create a batch file (no Vb scripting permitted on our network). And I am stuck...
Background:-
We have a batch file which is run at login from the startup folder on a remote PC. At the moment when the application is run by the batch file at start up it crashes for some reason, probably because of a shortage of resources during log on. Running the batch file manually, later, works fine.
My solution is to put a delay in the batch file. Windows XP does not have a "sleep" command. I have found Sleep.bat, which uses ping to create the delay, but requires an IP address to ping. I do not wish to ping a server, as this may be detected by our IT Guys at head office, and in any case the server may be removed at some time in the future. As we use DCHP I cannot guarantee that any specific IP address will stay valid, so I intend pinging the PC the batch file is running on, having read the IP address into an environment variable. My script for obtaining the IP address, (such as it is) is:-
=========================================================
@ECHO OFF
REM
REM GetIP.bat
REM Gets the IP address of PC it is run on.
REM save the relevant line of the IPconfig output to a
REM text file
ipconfig | findstr "Address" > C:\ipfile.txt
=========================================================
The result is a text file containing the following line:-
IP Address. . . . . . . . . . . . : 255.255.255.255
(Fictitious IP address)
I now need to extract the end of that line starting with the character two to the right of the :
How do I achieve this using only batch file commands included in Windows XP Professional?
Any assistance would be most appreciated!
Michael
Background:-
We have a batch file which is run at login from the startup folder on a remote PC. At the moment when the application is run by the batch file at start up it crashes for some reason, probably because of a shortage of resources during log on. Running the batch file manually, later, works fine.
My solution is to put a delay in the batch file. Windows XP does not have a "sleep" command. I have found Sleep.bat, which uses ping to create the delay, but requires an IP address to ping. I do not wish to ping a server, as this may be detected by our IT Guys at head office, and in any case the server may be removed at some time in the future. As we use DCHP I cannot guarantee that any specific IP address will stay valid, so I intend pinging the PC the batch file is running on, having read the IP address into an environment variable. My script for obtaining the IP address, (such as it is) is:-
=========================================================
@ECHO OFF
REM
REM GetIP.bat
REM Gets the IP address of PC it is run on.
REM save the relevant line of the IPconfig output to a
REM text file
ipconfig | findstr "Address" > C:\ipfile.txt
=========================================================
The result is a text file containing the following line:-
IP Address. . . . . . . . . . . . : 255.255.255.255
(Fictitious IP address)
I now need to extract the end of that line starting with the character two to the right of the :
How do I achieve this using only batch file commands included in Windows XP Professional?
Any assistance would be most appreciated!
Michael