Czajnik
Czajnik

Reputation: 1

Making list of files from folder and adding additional text via powershell

I'm trying to make list of kb in folder and add to results some additional text. Im trying like that, but its not like I want:

    $nazwa = Get-ChildItem -file "c:\2012 standart\" | select name 

     for($a=1 ; $a -le $nazwa.Length; $a++)
     {
      "start"
     "$nazwa[$a]"+"addiotional text"
     "stop"
      }

I would like results like that:

start

file1 additional text
file2 additional text
file3 additional text

stop

Where is the problem? Will be great grateful for any help.

Upvotes: 0

Views: 35

Answers (1)

János Spengler
János Spengler

Reputation: 109

write-host "start"
$nazwa=Get-ChildItem -file "c:\temp\" |  select-object name 

foreach ($i in $nazwa  )
{
    write-host $i.name "addiotional text"
}
write-host "end"

Upvotes: 1

Related Questions