Why gives pinging from a compiled VFP program no results but works from the developing environment?

When I try to get a compiled VFP exe-file to show the pinging results in a text file, the text file becomes blank (empty) but when I do it from the VFP programming environment it works and the text file shows the following result:

Pinging 192.168.16.11 with 32 bytes of data:
Reply from 192.168.16.11: bytes=32 time=12ms TTL=128
Reply from 192.168.16.11: bytes=32 time=13ms TTL=128
Reply from 192.168.16.11: bytes=32 time=13ms TTL=128
Reply from 192.168.16.11: bytes=32 time=13ms TTL=128

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


I have tried following command:
RUN "c:\windows\system32\cmd.exe, /c ping 192.168.16.11 > C:\Ping\pinglog.txt"

How do I do in order to get the the pinging result in the text file from the compiled program?
AndHofOwnerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bbaoIT ConsultantCommented:
does the user running the app in prod environment have sufficient rights to access folder C:\PING?

please be aware that the folder is not a pre-existing folder on a Windows computer.
0
AndHofOwnerAuthor Commented:
I run the compiled program and the source program from the same machine and I have the administrator rights. The text file is created in both cases but when I run the compiled exe-file the text file is empty.
0
bbaoIT ConsultantCommented:
> the text file is empty.

do you mean if the plain text file isn't existing under C:\PING and the data file's filename can be seen (generated) but with no content?
0
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

AndHofOwnerAuthor Commented:
Yes, when I ping in the developing environment the content in the text file C:\Ping\pinglog.txt is as I described it in the original question above. However, with the same command in a compiled exe-file the txt-file C:\Ping\pinglog.txt  is generated but with no content.
0
pcelbaCommented:
This is possible for many reasons, e.g.
1) Your firewall blocks your exe from pinging
2) Your exe name is ping.exe
3) Executing external programs is not allowed by your OS settings

I've created a small EXE  (Myping.EXE) having one line of code in the main PRG:
RUN "c:\windows\system32\cmd.exe, /c ping 192.168.2.1 > C:\Ping\pinglog.txt"
and it works for me without problems in W7/64...
Of course, I have full access to c:\ping\ and I am administrator on the machine but the EXE does not require elevated rights.

If nothing from above hints helps then you could post your testing EXE for analysis? (Rename it to .TXT and ZIP it please.)

Update:
This command should also work
RUN ping 192.168.2.1 > C:\Ping\pinglog.txt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndHofOwnerAuthor Commented:
Yes, you are right. The name of the program was ping.exe. However, I do not understand the problem with that. Could you please explain. However, I changed the name to pinghead and now it works. Thank you for your help.
0
pcelbaCommented:
The VFP app named PING.EXE looks into the app home folder first and the PING.EXE found in this folder has a precedence over the OS ping command which is also named PING.EXE (and stored in Windows\System32\).

The FoxPro IDE uses different default folder (VFP home folder probably) and the OS search finds the OS PING.EXE earlier than your own PING.EXE.

You could keep the name of your VFP app PING.EXE but then you must specify the full path to the PING.EXE from Windows\System32\ folder in RUN command.
0
AndHofOwnerAuthor Commented:
Thank you for putting time on such a simple question. I should have realized this myself after having worked with VFP programming for many years. But sometimes you can not see the forest for the trees (an old Swedish proverb freely translated). Either way, you saved a lot of time for me and I am very grateful for that.
Goodbye now and the case is closed.
0
pcelbaCommented:
We are saying it the same way but Ovidius wrote: Frondem in silvis non cernere
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FoxPro

From novice to tech pro — start learning today.