Batch File - Either Append or Hide Blank?
Posted: 29 Apr 2010 17:33
Hi All
I'm writing a batch file (and I'm a newbie so excuse any stupid questions) that will ping a number of locations and will report all the items it doesn't get a response from. Currently, when it gets no response, it created a variable with the name of the location. What I would like to do is have it display all the variables it created at the end of the file so that you can see what was unreachable.
I'm guessing to do this, I would need to either append to a variable - Eg., location=location+south (with south being the newly undiscoverable location)... and it would just keep adding on. But I don't know how to do this. And is it possible to separate them with their a comma or put them on a new line so they display better?
Or the other way is I thought each location will get it's own variable - Eg., location1=south, location2=north... and at the end it would just list location1, location2, etc. But how do I get it to not list anything for any variable that wasn't set as it wouldn't have been set it if was found? Does that make sense? Currently when I try for blank variables it says "Echo is off.". I don't want it to say anything for blank variables.
I'm not sure which way would be best but currently I can't work out how to do either. So any help would be greatly appreciated.
Thanks.
I'm writing a batch file (and I'm a newbie so excuse any stupid questions) that will ping a number of locations and will report all the items it doesn't get a response from. Currently, when it gets no response, it created a variable with the name of the location. What I would like to do is have it display all the variables it created at the end of the file so that you can see what was unreachable.
I'm guessing to do this, I would need to either append to a variable - Eg., location=location+south (with south being the newly undiscoverable location)... and it would just keep adding on. But I don't know how to do this. And is it possible to separate them with their a comma or put them on a new line so they display better?
Or the other way is I thought each location will get it's own variable - Eg., location1=south, location2=north... and at the end it would just list location1, location2, etc. But how do I get it to not list anything for any variable that wasn't set as it wouldn't have been set it if was found? Does that make sense? Currently when I try for blank variables it says "Echo is off.". I don't want it to say anything for blank variables.
I'm not sure which way would be best but currently I can't work out how to do either. So any help would be greatly appreciated.
Thanks.