|
|
|||||||
O.K. I tend to hate this, but here is goes. Does anyone know the correct format of the following command to use in Win9x, and not NT/2k c:\winnt\system32\cmd.exe /Q /E:1024 /C FOR /F "TOKENS=2* DELIMS= " %%i IN ('"PING -a -n 1 216.239.51.100 | FIND "]""') DO ECHO %%i >c:\report.txt pause This will work in a NT format, but get an invalid switch for Win9x. Sad thing is that I cannot find out where that invalid witch is. Any Clues???? |
||||||||
|
|
|||||||
well the first clue is that "c:\winnt\system32\cmd.exe" is NT specific. Should be %comspec%. But then you probably are not using "c:\winnt\system32\cmd.exe" or else you would not be getting an "invalid switch" error. I don't have any Wintendos to test on but my guess it the /Q switch. Spark up a DOS box and enter COMMAND /? to see the valid switches. |
||||||||
|
|
|||||||
LOL yes I know that c:\windows\command.com, and c:\winnt]system32\cmd.exe are the two different ones. Thanks for pointing that out LLigetfa. I do have %comspec% in the Kix script, and then pulling the result, to display the information. Al that works, but here is the main issues I have. SHELL '%Comspec% /Q /E:1024 /C FOR /F "TOKENS=2* DELIMS= " %%i IN ('+ CHR(39) + '"PING -a -n 1 $ipnum | FIND "]""' + CHR(39) + ') DO ECHO %%i >' + $tempfile Only works in a NT/2K/XP enviorment. DOS only tells me I have an inavlid switch on a WIN9X platform. And for the life of me I cannot find that stupid invalid switch. In short I was just trying to ping two IP's One is google.com, and the other is behind a vpn. Wanted to know the results of the two so that I can know if the user is logged onto the ISP, and then the VPN. Using Watlz function this is what I have: code:It works just right, but only on a NT platform.? REVPING("1.1.100.229") So Hopefully some OLD SCHOOL people can tell me what the hell is the invalid switch. |
||||||||
|
|
|||||||
forget it ... I wrote it too (see ping() udf) and didn't found anything but that FOR isn't available in 9x |
||||||||
|
|
|||||||
Hmmm ... looking at the code tells me that I did actually wrote that line If you look a bit deeper you will find ping() udf which Waltz took and adapted to return names from ip ... At least I mentioned in REQUIREMENTS the supported OS's |
||||||||
|
|
|||||||
Ahh O.K. jpols is de man to ask! Your Ping() function also for a NT platform. it does in fact work perfect, and I do not reallt care about the DNS hostname conversion. Here is the challenege for the day. Can you, or is it possible to ping the followng IP's in a WIN9X platform: VPN 1.1.100.229 PUBLIC 216.239.51.100 and just say true or false if it connected to the IP's or not? |
||||||||
|
|
|||||||
Think you have to go the hard way piping the output to a textfile open, read and do a little string manipulation ... or you might also want to try one of the pipe() udfs we got hth |
||||||||
|
|
|||||||
Or did you meant saying if the ping returns reply ? That is actually possible ... or was it a fact that 'find' also denied to work on 9x ? Can't remember anymore ... long time not used 9x for anything else than gaming |
||||||||
|
|
|||||||
Ahhhh Gaming gooood.... But just want to do like this in DOS ping 216.239.51.100 but in KIX how can you do that? In short I just wanted to know if you pinged an ip it could tell you yeah I can see it, or NOPE cannot see that ip, so that the rest of my script will continue or not. So if the script or a function could just outpu true or false the the IP in the request. |
||||||||
|
|
|||||||
my gaming platform is KiOSX, so need for win9x there either |
||||||||
|
|
|||||||
sure it can something like: code:shell '%comspec% /c ping $ip | find "0% loss" >null' |
||||||||
|
|
|||||||
So any ideas guys? |
||||||||
|
|
|||||||
So, what exactly is your problem? You cannot SHELL out your PING and then check a resulting text file? Lonkeros code doesn't work for you? The PING() UDF doesn't work for you? Could you please be precise? [ 28. February 2003, 17:50: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
This may be a bit late, but FOR /F is not supported in 9x. I don't have any 9x boxes right at hand, so I can't be much more help than that on the shell side, but think you would probably be best off sending the output to file and parsing that in KiX. |
||||||||
|
|
|||||||
Yep Jim, think I mentioned that before Hello Microcyb ??? You still around ? |
||||||||
|
|
|||||||
Yep still around, and still no luck |
||||||||
|
|
|||||||
microcyb, what did my code return? please, could you help us help you? |
||||||||
|
|
|||||||
Well, not sure but every ping no matter if it is a bad ip or a good ip, says ping sucessfull. so if I ran your script to ping 0.0.1.1 it says it pinged, and if you place in a good ip, it says the same result. |
||||||||
|
|
|||||||
well, simple check to ping reply retrieved that the string was little wrong. you will be perfectly server with: code:$ip="0.0.1.1" |
||||||||
|
|
|||||||
Still says ping succesfull even for a bad ip address. |
||||||||
|
|
|||||||
could you please tell what ping returns in win9x. that code above works just fine on NT-based machines. |
||||||||
|
|
|||||||
Works for me. Mind you, I don't have Wintendo to test on. Maybe should post back the code you are trying in case you are modifying Jooels. [ 17. March 2003, 20:58: Message edited by: LLigetfa ] |
||||||||
|
|
|||||||
Me, Awaiting Reply, Chief of Nutshell tribe says "TTL=" is only way white man gets right answer, Hugh ! |
||||||||
|
|
|||||||
I was waiting for that comment jochen. I don't like the ttl way and that's it. |
||||||||
|
|
|||||||
Well there's already a gazillion examples posted using "TTL"... |
||||||||
|
|
|||||||
Ugh... #$%@^ Can't believe author of PostPrep don't use for his own code posting either. Very easy to setup a link/shortcut to run it Jooel I'm getting lazy. Even short code is much easier to copy from board when PostPrep is used. Now where did I hide that Write/MS Word application? |
||||||||
|
|
|||||||
This works on XP and 98... code: |
||||||||
|
|
|||||||
Tried your snippet as well Lonkero. I also get ping successful on every address in win98, even though the "(0% loss)" should work... code: [ 18. March 2003, 01:31: Message edited by: CitrixMan ] |
||||||||
|
|
|||||||
k, now we are helping a boy that seems not to wont that help. shane, could you check on commandline what the find returns on win9x? if it works as expected, do after it: echo %errorlevel% to see does win9x find return errorcode. if it does, then command.com does not. |
||||||||
|
|
|||||||
Lonkero, Windows 95 does not have the 0% loss on my test system. If you do this, it does find it, but apparently does not set an errorlevel when I echo %errorlevel% to the console it is blank. If you give it something real to find it will display on console what it found, but if you give it something bogus to find it remains blank on console. shell '%comspec% /c ping $ip | find "Request timed out" >null' That's why you always get a SUCCESSFUL answer as the errorlevel is never set on Windows 95 |
||||||||
|
|
|||||||
thanks for the answer. |
||||||||
|
|
|||||||
Yea...What NTDoc said... |
||||||||
|
|
|||||||
Ok, if noone likes 'TLL=' I explain it more to the point and hopefully everyone will agree that it is the only way : So, assuming you run Windows NT Workstation, how would you ever get a valid response in finding '0% loss' (there is never ever such a phrase on Console !) sample : quote:(Have you noticed that there is "TTL=" in every reply ???) Good, and now for guys trying to search for "TTL" which CAN also result in erroneous response ! Here is the CAN case : quote:As you might see there is in fact a TTL to be found but that doesn't mean that you get reply from the machine you pinged ! so 'TTL=' is it (for any MS OS you can imagine !) {edit}Oh yeah ! 'Request timed out' is also nonsense : quote:would return 'reply' {/edit} [ 19. March 2003, 09:32: Message edited by: jpols ] |
||||||||
|
|
|||||||
Jochen... dude, you need to fire up a Windows 95 client and try a ping to a valid address that is not responding. You will see: Request timed out in the result on the console. I said nothing about NT/2000/XP this test is ONLY for Windows 95 I might assume that 98 responds the same, not sure about ME as it did add some minor new stuff that 2000 has. |
||||||||
|
|
|||||||
Sorry , I have none ... Ok, still valid is that from at least NT 3.x upwards there is no other way than finding "TTL=" for reply from pinged machine. But Ron, don't you accept that 'request timed out' is out of the loop (if one likes to provide a global valid solution) as for the possible 'BAd Ip Address' one always can have due to resolution problems, especially with WINS ? Anyway, if my little time allows I will test this evening from my daughters ME installation [ 19. March 2003, 09:57: Message edited by: jpols ] |
||||||||
|
|
|||||||
hmmm... not sure you can have a GLOBAL 1 size fits all piece of code here. The returned text on Windows 95 is not the same as NT/2000/XP I also think that ME does show similar to 2000 The start of this topic was about the guy wanting to get a response from Win9x. We all know NT/2000/XP works just fine. Not that big of a deal, more a request to get an antique OS to return a value to test against. |
||||||||
|
|
|||||||
So , the only question left is : does this work on a Windows 95 Computer ? break on $Computer = "" ; Place here any valid (and online) Computer/IP-Address shell '%Comspec% /C ping $Computer | find /C "TTL=" > nul' if @error = 0 $Computer + " replied to the ping request!" ? else $Computer + " was reported OFFLINE, please verify on console!" ? endif get $ agreed ? |
||||||||
|
|
|||||||
Jochen, Here is what you get from a Windows 95 workstation. Notice that a valid ping first, then run script... Looks okay. Then ping an address that times out, ping shows REQUEST TIMED OUT Then run script... Still says it replied to the ping request even though it DID NOT. That is because @error is not being set. i.e. There is no %errorlevel% set on Windows 95, thus this method can not be used. C:\SCRIPTS>ping 192.168.1.101 Pinging 192.168.1.101 with 32 bytes of data: Reply from 192.168.1.101: bytes=32 time=1ms TTL=128 Reply from 192.168.1.101: bytes=32 time=1ms TTL=128 Reply from 192.168.1.101: bytes=32 time=1ms TTL=128 Reply from 192.168.1.101: bytes=32 time=1ms TTL=128 C:\SCRIPTS>kix32 9x2.kix 192.168.1.101 replied to the ping request! C:\SCRIPTS>ping 139.104.117.95 Pinging 139.104.117.95 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. C:\SCRIPTS>kix32 9x2.kix 139.104.117.95 replied to the ping request! |
||||||||
|
|
|||||||
Ouch ! Ok ... then there is no valid method for 95 (except maybe some fancy wsh methods ) as it'd also fail on 'request timed out' (if i got that correctly it does not set errorlevel in any case) So Microcyb ... TASK = Declare all networked 9x machines as Gameboys (Be a man, accept the facts !) |
||||||||
|
|
|||||||
Hey ! Not to forget that my statement about "TTL=" is still valid for all (MS) NON-9x OS Quod Erat Demonstrandum ! |
||||||||
|
|
|||||||
k, now as we got this far, I would suggest that all who want to make the ping work, use Ping() UDF |