While Statement
Hi,
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...
\\SERVER1\program.exe
\\SERVER2\program.exe
\\SERVER3\program.exe
\\SERVER4\program.exe
\\SERVER5\program.exe
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.
Comments 5 Comments • Jump to latest comment
Attachment
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.
Here you go, mailed also.
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.
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.
Would you like to reply?
Login or Register to post your comment.