Saved Bookmarks
| 1. |
Solve : Ping Specific Ip batch file? |
|
Answer» How can i do ? @echo offThis is the absolute minimum code that will do the desired task set /p ip=IP Address to ping: ping -t %ip% The -t switch tells ping to continue until Ctrl + C are pressed. i am in a good mood too. here's a vbscript. Code: [Select]'******************************************************* '* Name: pingMachineArgs.vbs **** '* Function: Ping a machine * '* Input: Machine IP/hostname * '* Limitation: Only a few response cases. **** '* Author: ghostdog74 **** '* Usage: cscript /nologo pingMachineArgs.vbs 127.0.0.1 * '******************************************************* Option Explicit Dim objPing,objFSO,objArgs Dim query,PingMachine,PING,response Set objArgs = WScript.Arguments PingMachine=objArgs.Item(0) Set objFSO=CreateObject("Scripting.FileSystemObject") query="select * from Win32_PingStatus where address ='"& PingMachine & "'" Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery(query) For Each PING In objPing Select Case PING.StatusCode Case 0 response="Reply from " & PING.ProtocolAddress Case 11002 response="Destination Net Unreachable" Case 11003 response="Destination Net Unreachable" Case 11010 response="Request Timed Out" End Select Next WScript.Echo response Code: [Select]@ECHO OFF COLOR 0A TITLE PingUtil :LOOP1 SET /P ENDMAQ=ENDERECO: TITLE %ENDMAQ% ping -t %ENDMAQ% TITLE PingUtil SET ENDMAQ= GOTO LOOP1 Now how can i doto rename the tittle window to %ENDMAQ% ON if it is responding and %ENDMAQ% OFF if not respondig ?If not respondig, errorlevel will be 1, otherwise will be 0. But you can't use -t in this case. You must ping de ip address, check errorlevel, CHANGE title, and go to loop1Maybe I GOT this wrong, but I understand that if you: @echo off ping xxx.xxx.xxx.xxx OR @echo off ping name_of_the_resorce you should be done |
|