0phoi5 Posted December 21, 2016 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
0phoi5 Posted December 22, 2016 Author 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
digip Posted December 27, 2016 Posted December 27, 2016 What version of windows are you running? Quote
0phoi5 Posted December 29, 2016 Author Posted December 29, 2016 On 27/12/2016 at 5:06 AM, digip said: What version of windows are you running? 7 Quote
digip Posted December 30, 2016 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
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.