![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Tutorials on arrays in VBScript? I commonly use the FOR %%I IN in a batch file to pull a list from a text file and execute a command plugging in each line from the text file. I would like to be able to do this in VBScript, but can't seem to find the right tutorials. I know I need to load the data into an array, but I'm not sure what to do from there. Can anyone help with a "how to" or tutorials? Thanks! Christopher Beard |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Tutorials on arrays in VBScript? "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in message news:74FF5ECF-BFCE-4F87-8F2F-344EB08D9E79@xxxxxx Quote: >I commonly use the FOR %%I IN in a batch file to pull a list from a text >file > and execute a command plugging in each line from the text file. I would > like > to be able to do this in VBScript, but can't seem to find the right > tutorials. I know I need to load the data into an array, but I'm not sure > what to do from there. Can anyone help with a "how to" or tutorials? > Thanks! > Christopher Beard equally easily read the text file on a line by line basis. Download a copy of script56.chm from the Microsoft site, then have a look at these methods: For arrays: - oFSO.OpenTextFile.ReadAll - split For a line-by-line read: - oFSO.OpenTextFile.ReadLine - oFSO.OpenTextFile.AtEndOfStream The Scripting Guy files can also be of tremendous help: http://www.microsoft.com/downloads/d...displaylang=en |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Tutorials on arrays in VBScript? I will research this info. Thank you very much! "Pegasus (MVP)" wrote: Quote: > > "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in > message news:74FF5ECF-BFCE-4F87-8F2F-344EB08D9E79@xxxxxx Quote: > >I commonly use the FOR %%I IN in a batch file to pull a list from a text > >file > > and execute a command plugging in each line from the text file. I would > > like > > to be able to do this in VBScript, but can't seem to find the right > > tutorials. I know I need to load the data into an array, but I'm not sure > > what to do from there. Can anyone help with a "how to" or tutorials? > > Thanks! > > Christopher Beard > You *can* load the data into an array but you don't have to - you can > equally easily read the text file on a line by line basis. Download a copy > of script56.chm from the Microsoft site, then have a look at these methods: > > For arrays: > - oFSO.OpenTextFile.ReadAll > - split > > For a line-by-line read: > - oFSO.OpenTextFile.ReadLine > - oFSO.OpenTextFile.AtEndOfStream > > The Scripting Guy files can also be of tremendous help: > http://www.microsoft.com/downloads/d...displaylang=en > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Tutorials on arrays in VBScript? I have an example VBScript program that reads names from a text file and adds them to a group. The program demonstrates how to read lines from a file and is linked here: http://www.rlmueller.net/Add%20Users...0Group%201.htm -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in message news:F6148C01-49DC-4431-AA3D-578EB94A7A2E@xxxxxx Quote: >I will research this info. Thank you very much! > > "Pegasus (MVP)" wrote: > Quote: >> >> "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in >> message news:74FF5ECF-BFCE-4F87-8F2F-344EB08D9E79@xxxxxx Quote: >> >I commonly use the FOR %%I IN in a batch file to pull a list from a text >> >file >> > and execute a command plugging in each line from the text file. I would >> > like >> > to be able to do this in VBScript, but can't seem to find the right >> > tutorials. I know I need to load the data into an array, but I'm not >> > sure >> > what to do from there. Can anyone help with a "how to" or tutorials? >> > Thanks! >> > Christopher Beard >> You *can* load the data into an array but you don't have to - you can >> equally easily read the text file on a line by line basis. Download a >> copy >> of script56.chm from the Microsoft site, then have a look at these >> methods: >> >> For arrays: >> - oFSO.OpenTextFile.ReadAll >> - split >> >> For a line-by-line read: >> - oFSO.OpenTextFile.ReadLine >> - oFSO.OpenTextFile.AtEndOfStream >> >> The Scripting Guy files can also be of tremendous help: >> http://www.microsoft.com/downloads/d...displaylang=en >> >> >> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Tutorials on arrays in VBScript? Awesome! Thank you very much! "Richard Mueller [MVP]" wrote: Quote: > I have an example VBScript program that reads names from a text file and > adds them to a group. The program demonstrates how to read lines from a file > and is linked here: > > http://www.rlmueller.net/Add%20Users...0Group%201.htm > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > > "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in > message news:F6148C01-49DC-4431-AA3D-578EB94A7A2E@xxxxxx Quote: > >I will research this info. Thank you very much! > > > > "Pegasus (MVP)" wrote: > > Quote: > >> > >> "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in > >> message news:74FF5ECF-BFCE-4F87-8F2F-344EB08D9E79@xxxxxx > >> >I commonly use the FOR %%I IN in a batch file to pull a list from a text > >> >file > >> > and execute a command plugging in each line from the text file. I would > >> > like > >> > to be able to do this in VBScript, but can't seem to find the right > >> > tutorials. I know I need to load the data into an array, but I'm not > >> > sure > >> > what to do from there. Can anyone help with a "how to" or tutorials? > >> > Thanks! > >> > Christopher Beard > >> > >> You *can* load the data into an array but you don't have to - you can > >> equally easily read the text file on a line by line basis. Download a > >> copy > >> of script56.chm from the Microsoft site, then have a look at these > >> methods: > >> > >> For arrays: > >> - oFSO.OpenTextFile.ReadAll > >> - split > >> > >> For a line-by-line read: > >> - oFSO.OpenTextFile.ReadLine > >> - oFSO.OpenTextFile.AtEndOfStream > >> > >> The Scripting Guy files can also be of tremendous help: > >> http://www.microsoft.com/downloads/d...displaylang=en > >> > >> > >> > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Tutorials | General Discussion | |||