![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Using lines in a text file I have a text file with names of applications such as Agent, E-Notify, etc. I read the content of the file with Get-Content. I want to use the application names to create a path like : "C:\" + $appname. How can I use the output from get-content? While? ForEach? -- Terry Edwards |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Using lines in a text file If the file contains one app name per line you can pipe the contents to Join-Path's -ChildPath parameter: gc .\Apps.txt | join-path 'c:\' -ch {$_} -- Kiron |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Using lines in a text file On Jul 31, 1:14*pm, tERRY <tE...@xxxxxx> wrote: Quote: > I have a text file with names of applications such as Agent, E-Notify, etc. I > read the content of the file with Get-Content. I want to use the application > names to create a path like : "C:\" + $appname. How can I use the output from > get-content? While? ForEach? > -- > Terry Edwards per line. Try this: Get-Content appfile.txt | Foreach {md "C:\$_"} |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Using lines in a text file Thanks a bunch. Your suggestion worked like a charm. As a newbie to PS and to object oriented programming it was getting the pieces in the right relation that had me stumpted. -- Terry Edwards "tojo2000" wrote: Quote: > On Jul 31, 1:14 pm, tERRY <tE...@xxxxxx> wrote: Quote: > > I have a text file with names of applications such as Agent, E-Notify, etc. I > > read the content of the file with Get-Content. I want to use the application > > names to create a path like : "C:\" + $appname. How can I use the output from > > get-content? While? ForEach? > > -- > > Terry Edwards > Foreach should work fine in this situation, since gc grabs one string > per line. Try this: > > Get-Content appfile.txt | Foreach {md "C:\$_"} > > > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Howto: Add lines of text from a specific point in a text file.. | VB Script | |||
| get the number of lines in a text file | PowerShell | |||
| Removing lines from a text file | PowerShell | |||
| return only certain lines from large text file | PowerShell | |||
| removing first three lines in a text file | PowerShell | |||