Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Help with batch file [costum message]  (Read 4023 times)

0 Members and 1 Guest are viewing this topic.

aljax

    Topic Starter


    Greenhorn

  • Just having fun =D
    • SloPlays
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Help with batch file [costum message]
« on: December 12, 2015, 08:15:41 AM »
so....

I am making a "go-to-program-shortcut-file" -->[.bat]   (for now still in work...)

and i need some help.
Is it possible to change the "ping message" ? ? ?


I would like it to not display


pinging google.com [ip] with . . .
Reply from [ip] bytes=32 . . .
Reply from [ip] bytes=32 . . .
Reply from [ip] bytes=32 . . .
Reply from [ip] bytes=32 . . .





I want it to display something like

Pinging google.com
connection status : connected    (or disconnected)
your ping is [ping]                    (if the user has internet connection)




I appreciate any kind of help . . .
Thank you for support. :)


Aljax




Having fun with batch_files/CMD

You can join my MineCraft server
IP : sloplays.playat.ch

DaveLembke



    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Help with batch file [costum message]
« Reply #1 on: December 12, 2015, 08:43:37 AM »
Your output is going to be sort of worthless for troubleshooting.

Your chopping out the most important feature of Ping which is latency info and failed Ping count which you want to see 0% loss. From looking at what you want. It could say that your connected but yet you could have a major network issue going on.
Quote
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\dave>ping 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Users\dave>

Trying to understand why Ping as it is is not good enough?

As far as shaping the output to say whatever you want, it can be done, but not in real time. There would be a slight delay in what is measured and then what is parsed as the output to the display. To get rid of this delay would require writing your own Ping program so that the output is as you want it without having to reshape it to an alternate display layout to user.

aljax

    Topic Starter


    Greenhorn

  • Just having fun =D
    • SloPlays
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: Help with batch file [costum message]
« Reply #2 on: December 12, 2015, 08:59:22 AM »
it is ok if there is a little delay . . .
goes fine with me  :)
soooo
can you learn me something ?

[say yes XD]

if yes, is it possible to send a personal message on this forum [ill paste in my code so if you want, you can help me a bit]
Having fun with batch_files/CMD

You can join my MineCraft server
IP : sloplays.playat.ch

Salmon Trout

  • Guest
Re: Help with batch file [costum message]
« Reply #3 on: December 12, 2015, 09:25:09 AM »
I agree with Dave, but if you must do it then try this

By the way, no PMs, whatever help you get or don't get is here in the thread that you started.

Code: [Select]
@echo off
set host=www.google.com
echo Pinging %host%
set status=disconnected
ping -n 1 %host%>nul && set status=connected
echo Connection status : %status%
if "%status%"=="connected" for /f "tokens=1-7 delims== " %%A in ('ping -n 1 %host% ^| find "Reply from"') do echo Your ping is %%G

The output was:

Code: [Select]
Pinging www.google.com
Connection status : connected
Your ping is 21ms

aljax

    Topic Starter


    Greenhorn

  • Just having fun =D
    • SloPlays
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: Help with batch file [costum message]
« Reply #4 on: December 12, 2015, 10:57:37 AM »
Thank you man  :)
appreciate that . . .
Ill send you finished version
score it from 1 to 5 please and tell me what you think i should add in .
thnx again 4 reply and support  :D
Having fun with batch_files/CMD

You can join my MineCraft server
IP : sloplays.playat.ch

aljax

    Topic Starter


    Greenhorn

  • Just having fun =D
    • SloPlays
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: Help with batch file [costum message]
« Reply #5 on: December 12, 2015, 10:59:23 AM »
and "PMs"???
what is this ?
i'm from Slovenija so i don't know much about English spech shortcust
Having fun with batch_files/CMD

You can join my MineCraft server
IP : sloplays.playat.ch

Salmon Trout

  • Guest
Re: Help with batch file [costum message]
« Reply #6 on: December 12, 2015, 11:08:38 AM »
Quote from: aljax
and "PMs"???what is this ?

Quote from: aljax
if yes, is it possible to send a personal message on this forum [ill paste in my code so if you want, you can help me a bit]

aljax

    Topic Starter


    Greenhorn

  • Just having fun =D
    • SloPlays
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: Help with batch file [costum message]
« Reply #7 on: December 12, 2015, 11:29:21 AM »
Thanks everybody [two man] who replied so fast and with great support  :)
Having fun with batch_files/CMD

You can join my MineCraft server
IP : sloplays.playat.ch