Video Screencast Help

While Statement

Created: 07 Feb 2013 • Updated: 08 Feb 2013 | 5 comments
This issue has been solved. See solution.


I'm finding it difficult to do something and wondered if I may call upon some assistance.
Infact it's difficult for me to explain so will try my best here. My issue is actually the same problem as in this thread which is explained better. I'm trying to add some extra functionality to the end of it...

Is there anyway to seperate a variable such as %SERVERS% which contain data such as \\SERVER1 \\SERVER2 \\SERVER3 \\SERVER4 \\SERVER5
these would all be in one string, to form 5 command lines like this...


Somehow in a While Statement? although I'm struggling to put a condition into it.

In more detail this is what I'm trying to do....

I'm generating a list of servers on the network from running a NET VIEW command and outputing the contents to a file called servers.txt
Then I'm tidying it up a bit with some magic to remove empty lines and other characters I don't need.
Once this is done, I take that file and read it back in line by line to a variable called %MACHINE%
Then I set a new variable called %SERVERS% based on %MACHINE%%CRLF% and have a listbox showing me my server list.
You can select one or many servers from the list and the ones you select are sent to RESULT but they're in the format as shown above like \\SERVER1 \\SERVER2 etc

I want to build a command line up with these server names now but I can't figure out how to do it.

Can anyone help me?

I've attached what I have so far if that helps.

Discussion Filed Under:

Comments 5 CommentsJump to latest comment

EdT's picture

Can you supply an example servers.txt file?

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Paul1977's picture

Here you go, mailed also.

servers.txt 4.03 KB
EdT's picture

I have emailed you a short wisescript which does the parsing without any need for external vbscripts.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Paul1977's picture

Ed, absolutly fantastic, I have the script and it works great. Never actually thought of parsing variables more than once to get what I need. Have a few more bits to put in to it, should be fine from here onwards, thanks again.