Page 1 of 1
Problem with shell and ping
Posted: Thu Sep 27, 2012 5:22 pm
by jackads
Hello guys,
I'm trying to use the "ping" command in the shell, but it don't work. =/
When I try
Code: Select all
answer shell("ping 192.168.1.1")
--or
put shell("ping " & destino & pacotes & buffer) into field "Console"
imageshack.us/a/img27/4523/pingfail.jpg (my account can't post links or references =/)
"Ping isn't a command, program or batch file" =/
Like if ping doesn't exists, I don't know.
When I open the cmd and write the ping command it normally execute, but when I try to get the shell in livecode it tell me ping isn't a command, why?
Sorry the English, and thanks for the attention, God bless you all!
Re: Problem with shell and ping
Posted: Thu Sep 27, 2012 6:11 pm
by mwieder
What OS is this? Ping will normally run forever until it's canceled, so you probably want to say something like
Which will try four times and then return.
Re: Problem with shell and ping
Posted: Thu Sep 27, 2012 7:41 pm
by sturgis
The most likely problem is that the path environment is not the same when using lc shell. When you go to a command prompt you get a full shell, with a path that probably points to the folder where ping is.
Find where the ping command sits and give a full path to the executable.
jackads wrote:Hello guys,
I'm trying to use the "ping" command in the shell, but it don't work. =/
When I try
Code: Select all
answer shell("ping 192.168.1.1")
--or
put shell("ping " & destino & pacotes & buffer) into field "Console"
imageshack.us/a/img27/4523/pingfail.jpg (my account can't post links or references =/)
"Ping isn't a command, program or batch file" =/
Like if ping doesn't exists, I don't know.
When I open the cmd and write the ping command it normally execute, but when I try to get the shell in livecode it tell me ping isn't a command, why?
Sorry the English, and thanks for the attention, God bless you all!
Re: Problem with shell and ping
Posted: Thu Sep 27, 2012 9:47 pm
by jackads
You're completely right sturgis!
The full path is "C:\Windows\System32\ping", now it works great!
mwieder, my desktop OS is Windows 7 and my netbook OS is openSUSE, in windows and linux the default count parameter is 4, unlike to the infinity loop on Mac OS X, and others apple's OS (I think).
Thanks for the help guys, God bless you!
Re: Problem with shell and ping
Posted: Thu Sep 27, 2012 10:07 pm
by mwieder
Well, there's linux and there's linux.
My fedora core 16 ping also goes to infinity unless told otherwise. As do all the linux distros I've worked with lately.
Anyway, I'm glad you've got a solution, although I'm surprised that ping isn't in the Win7 path.
Re: Problem with shell and ping
Posted: Fri Sep 28, 2012 12:34 am
by sturgis
Seems like its just not in the lc environmental path from the description. I suspect opening cmd as a process and then running ping might work, will have to see when I am back on windows next. Currently am playing with ltsp on ubuntu server though so no chance to do so for a bit.
I'd be curious to know what get shell("set") returns for the path env variable on your machine jackads, does it point to system32? And what about if you do put $PATH from the message box? Do they match?
I've run in to this sort of thing with lc before where the environment at a prompt doesn't match, and so have to work around the problem, but its been long enough since it happened that I don't recall what the trouble was.
Maybe there is a difference when running in 64bit win 7, but lc is 32bit so perhaps there is an extra layer in there somewhere.
mwieder wrote:Well, there's linux and there's linux.
My fedora core 16 ping also goes to infinity unless told otherwise. As do all the linux distros I've worked with lately.
Anyway, I'm glad you've got a solution, although I'm surprised that ping isn't in the Win7 path.
Re: Problem with shell and ping
Posted: Fri Sep 28, 2012 12:45 am
by mwieder
Yeah, I'm not at a Windows box right now either. I'll check this out myself when I get the chance.
Re: Problem with shell and ping
Posted: Fri Sep 28, 2012 2:18 am
by mwieder
Update: ping.exe is in the path on both xp and Win7 64-bit. It's in C:\Windows\system32. The shell command should pick it up. Are you possibly running as a non-admin user with restricted privileges?