I have trouble to use several commands in one Foreach or Foreach-Object loop
My situation is -
- I have many text files, about 100.
So they are read
Get-ChildItem $FilePath -Include *.txt Every file's structure is same only key information is different. Example
User: Somerandomname
Computer: Somerandomcomputer
With -Replace command I remove "User:" and "Computer:" so $User = Somerandomname and $computer = "Somerandomcomputer.
In each circle $user and $Computer with -Append should be written to one file. And then next file should be read.
foreach-object { $file = $_.fullname;
should be used, but I can not figure out the right syntax for it. Could someone help me with it?
User: ...andComputer: ....on the same line, or subsequent lines? i.e. do you asking for a solution that reads 2 lines at a time?