Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

batch file ?

Posted on 2014-02-07
14
Medium Priority
?
486 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
  • +1
14 Comments
 
LVL 35

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 35

Accepted Solution

by:
Dan Craciun earned 2000 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
 
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 35

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We recently endured a series of broadcast storms that caused our ISP to shut us down for brief periods of time. After going through a multitude of tests, we determined that the issue was related to Intel NIC drivers on some new HP desktop computers …
Resolve DNS query failed errors for Exchange
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

722 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