Solved

batch file ?

Posted on 2014-02-07
14
476 Views
Last Modified: 2014-03-05
I have a program that will only run after you ping the host. I have no idea why but if you open it, it can't communicate with the host but if you ping the host PC it will opn and stay working till you close it. So I was thinking of a batch file that pings the host I just either put in the users startup or a scheduled task but they user complains that it shows the ping on his screen. Is ther any way of running this hidden to the user
0
Comment
Question by:Axis52401
  • 6
  • 3
  • 3
  • +1
14 Comments
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39843708
Call your batch from VBS:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run Chr(34) & "C:\path\to\pingserver.bat" & Chr(34), 0
Set WshShell = Nothing

Save the above as pingserver.vbs and schedule that to run at startup.

The important detail is the 0 parameter: sets intWindowStyle to 0, i.e. hidden


HTH,
Dan
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 39843800
you could always run a quick ping, i.e.
ping -n 1 -w 50 hostname >NUL
which should ping only once for maximum of 50ms.
you can probably do that minmised using start "" /min ......
Steve
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 39844189
depending upon how long it lasts working too you could add a ping in as a startup script in group policy or through HKLM/microsoft/windows/current verion/run key in registry then it would ping before user logs on to pc.

what is the app btw?  If you want to know why could try capturing network trafiic when it is already pinged, and when it is not.

sounds unlikely but could be if you added ip and mac address to arp table

arp -s x.x.x.x xx-xx-xx-xx-xx-xx

Steve
0
 
LVL 77

Expert Comment

by:Rob Williams
ID: 39844264
I believe you are asking for a single batch file for which you can have an icon or shortcut, that pings the host and then starts the application.  Something like the following should work, substituting the correct IP (or host name) and application path in place of notepad.  Just save as something like MyApp.bat  and double click on it to run.


ping -n 2 192.168.123.123
start  C:\Windows\system32\notepad.exe
Exit

Note:  "-n 2"  pings the host twice you can adjust how many times. If you need a delay of any sort, increase.
0
 
LVL 34

Accepted Solution

by:
Dan Craciun earned 500 total points
ID: 39844280
the user complains that it shows the ping on his screen.

I assume that means the OP had discovered batch and ping, and needs a way to make this silent...

Is there any way of running this (ping) hidden to the user?
0
 
LVL 77

Expert Comment

by:Rob Williams
ID: 39844286
The simplest way is to create a shortcut for the batch file, then under properties of the shortcut, under the "shortcut" tab, in the "Run" box select minimized.   This way you just show the command prompt window as an icon on the task bar for about 3 seconds instead of a command window.  To have it completly hidden I belive you would need to use VBS, which is not a strong suit of mine.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 77

Expert Comment

by:Rob Williams
ID: 39844291
Having said that:  it sounds like we are addresing the problem symptms and not the problem.  Why do we need to ping the host?  Perhaps a DNS issue?

In another question you address a VPN, is this over a VPN connection?
Is this a domain or workgroup environment?
0
 
LVL 2

Author Comment

by:Axis52401
ID: 39876807
its local not over a VPN, I have a host file entry to account for DNS
0
 
LVL 77

Expert Comment

by:Rob Williams
ID: 39903411
I am wondering why it works after you ping the host and not before.  When you ping the host it will add an entry in the local arp table.  This will expire in time.  Just as a test and to diagnose the problem, rather than pinging try first adding a static entry in the arp table.  To do so you need the IP and MAC address of the host, then use the following format:

arp  -s  192.168.123.123   1A-1A-1A-1A-1A-1A
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 39903501
Rob, I thought that could possibly be the case too http:#a39844189 but didn't get a response.

Steve
0
 
LVL 77

Expert Comment

by:Rob Williams
ID: 39903669
Sorry Steve, just reviewing open questions and missed you already suggested that.
Cheers!
--Rob
0
 
LVL 77

Expert Comment

by:Rob Williams
ID: 39906243
Thank you Jason0923.  I hope that did solve your problem but points should be awarded to dragon-it not me, or at a minimum a point split.  Please click the request attention link and ask the moderators to adjust.
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39906497
Not that I'm not grateful for the points, but I don't think that's the solution Jason wanted to accept :)
Maybe try again?
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Resolve DNS query failed errors for Exchange
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now