tags:

views:

46

answers:

2
– ping www.google.com –t

I have created a shortcut on desktop and typed this command as it's "Target " ..Now when I double click it, cmd window opens for a sec and vanishes..how do I make it run in the background until this process is manually ended ? The shortcut name's "Ping" and I don't see no Process named "Ping" in the task manager. What I want is to keep on pinging google server

+2  A: 

Solution 1: Do a manual ping from the command prompt and write a -t at the end which makes it a persistent ping. You would have to close the cmd prompt window to stop the ping.

for example type in command prompt: ping www.google.com -t

Solution 2: you can create a shortcut like so

cmd /c "ping www.google.com –t"

Solution 3: Any free ping utility would do what you require, check on google for "free ping" which will also work.

PK

Pavan
ok ran the command manually..it is pinging but msg like "Request Timed out" in between ..what does this mean ?
Serenity
Also when I created that shortcut like u said..it dsplayed cmd window for a sec saying "Bad parameter -t" This is what Target value is System32\cmd.exe /c "ping www.google.com –t" Is this correct ??
Serenity
Ping request timed out... The address was found but it isn't responding to ping requests. nothing wrong with your system. so dont worry.
Pavan
ok try it without the t. just make sure you run it in cmd instead.
Pavan
The shortcut's not running..what should be the target value ?
Serenity
I typed the command manually only when got that msg saying "Request Timed out"..what I want is this command to run in the background..don't want no cmd window open or minimized on my desktop
Serenity
http://www.tek-tips.com/faqs.cfm?fid=4377
Pavan
http://www.realgeek.com/forums/setting-up-ping-as-a-service-in-background-403727.html
Pavan
I have no frikkin idea how those scripts work..lol..but anyways thanks
Serenity
you should have enough information now to make this work.
Pavan
+2  A: 

set Target as: %windir%\system32\ping.exe www.google.com -t

and Start in: %windir%

[EDIT]

TO Hide a cmd window

        using System.Runtime.InteropServices;


        [DllImport("user32.dll")]
        static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
        [DllImport("user32.dll")]
        static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

In main

        IntPtr hWnd = FindWindow(null, "ping");
        if (hWnd != IntPtr.Zero)
        {
            ShowWindow(hWnd, 0);
        }

To Unhide

ShowWindow(hWnd, 1);
Barun
ok done..now how do I make it run it in the background?
Serenity
Can I recommend you using c# program ?
Barun
sure..will it take less of memory space ??
Serenity
It would not take much memory. You can do that whole thing by c# program without use ping exe at all. Should I give you that c# code or give u the code which will hide the ping cmd screen ?
Barun
the one that hides ping cmd screen will do ..thanks
Serenity
cool..thanks for the code :)
Serenity