It has been said that the ahcmd.exe file can be a bit flaky at times. People in here have noted that if at all possible you should find a way to use the ahscript.dll file. I had written a vbscript file that utilized the ahscript.dll, but running that through CScript proved to be kind of slow. I decided tonight to download visual basic express and build the script into an executable console application. I have named it x10cmd.exe.
When run in a DOS window, you use it like the ahcmd.exe program, but the returned information is slightly different. When you run "ahcmd queryplc D7 on", you don't see anythng returned on the command line. With x10cmd, you see the queried output. So if you run the same command "x10cmd queryplc D7 on", you will see -1, 0, or 1 for UNKNOWN, OFF, or ON respectively.
After testing, x10cmd.exe was slower than ahcmd.exe by only a fraction of a second whereas the vbscript version took close to twice as long to run. I am suspecting though that I will not have the occasional crashes like I was getting with ahcmd.exe.
Anyone interested in this file can download it
from here. It is 12kb in size vs ahcmd.exe which is 60kb, but it does require the ahscript.dll to be registered which shouldn't be an issue for those that have the SDK installed.
Hope it helps some of you.