Hi everybody and sorry for this lame question , but I´m truly struggling here. I can put files to be renamed into variable as well as content of the text file, like this:
$filestochange = Get-ChildItem -Path "c:\test"
$FileNames = Get-Content "c:\src.txt"
But how to pass it to Rename-Item command so every line in txt file was used to rename another file in a row?
I tried : Rename-Item -Path $filestochange -NewName $FileNames
Error comes up:
Rename-Item : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Path'. Specified method is not supported.
I was trying ForEach also, but I dont know how to put another variables for the rename-item command it that case as well.
I believe it is very simple, once somebody knows how to use all those $_. {}""
Please, help me go further. ¨Many thanks!