haze1434 Posted December 21, 2016 Share Posted December 21, 2016 (edited) Hi all, I'm having a very odd issue with a batch file, simply designed to ping a machine and report it up or down. The script is as follows; ping -n 1 192.168.0.1 | find "TTL=" >nul if errorlevel 1 ( echo Host down. ) else ( echo Host up. ) The weirdness comes from the fact that, if I run the above as Admin, it works fine. However, if I just double click the batch file as a standard user, it returns; ^C^C^C^C^C^C^C^C^C^C^C^Cthe process tried to write to a nonexistent pipe^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C etc... The CTRL+C (^C) prompts come up over and over for a while, until CMD crashes out. I'm not pressing CTRL+C. I have no idea what's going on! Edited December 21, 2016 by haze1434 amended coding syntax Quote Link to post Share on other sites
kdodge Posted December 21, 2016 Share Posted December 21, 2016 I just tried your BAT file on a freshly installed Win7, and it runs just fine as a normal user. I think something is gummed up in your system, try running just 'ping -n 1 192.168.0.1 | find "TTL=" ' without the null redirect at the end, and not in a BAT file, see what happens Quote Link to post Share on other sites
haze1434 Posted December 22, 2016 Author Share Posted December 22, 2016 13 hours ago, kdodge said: I just tried your BAT file on a freshly installed Win7, and it runs just fine as a normal user. I think something is gummed up in your system, try running just 'ping -n 1 192.168.0.1 | find "TTL=" ' without the null redirect at the end, and not in a BAT file, see what happens I get no return, but then that's expected. It doesn't crash CMD though. None of the odd behaviour above. What's confusing me is that it runs as Admin, same file from the same location, but not as my standard user account. Weird. It's on my standard user account's Desktop as well, so it should have no issues running it. Quote Link to post Share on other sites
kdodge Posted December 26, 2016 Share Posted December 26, 2016 i know in linux, ping requires special permissions to run over the iface, so maybe its a permission issue in windows? I think the windows tool is "icacls", but I'm not too sure about that. Also how did you create the BAT file? Did you make it on a different system and move it to the windows machine? If so, try opening plain old notepad and typing it out (no cut/pasting, e.g. no CRLF/LF problems) and don't try running it from a USB drive. Quote Link to post Share on other sites
digip Posted December 27, 2016 Share Posted December 27, 2016 What version of windows are you running? Quote Link to post Share on other sites
haze1434 Posted December 29, 2016 Author Share Posted December 29, 2016 On 27/12/2016 at 5:06 AM, digip said: What version of windows are you running? 7 Quote Link to post Share on other sites
digip Posted December 30, 2016 Share Posted December 30, 2016 (edited) On 12/29/2016 at 4:28 AM, haze1434 said: 7 Create a shortcut to the bat script. Right click the shourtcut, and then click advanced, and check "Run as administrator" and try again. Let me know what happens. http://imgur.com/a/VhYNX Edited December 30, 2016 by digip Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.