I need to display all elements of the $FileNames array in Powershell console. I am iterating in a For loop but i cant print double quotes to all Array index elements on the console. Please help.
Actual Result:Dropped file:- "$FileNames[$i]" successfully into the folder
Expected Result with Double quotes(for every filename in the array):Dropped file:- "NewFile1.txt" successfully into the folder... and so on.
$FileNames = @(Get-ChildItem $TestFolder\*.txt | Select-Object -ExpandProperty Name) For($i=0;$i -lt $FileNames.count;$i++) { if($FileNames[$i] -eq $fileName) { $filePathNew = $TestFolder + $FileNames[$i] Copy-Item -Path $filePathNew -Destination $RemoteURLFolder\$FolderName -Recurse Write-Host "=> Dropped file:- "'"$FileNames[$i]"'" successfully into the folder ""