Step 1:
Create a powershell file named as loopfiles.ps1 (you can simply create a new text file and rename it as loopfiles.ps1).
Step 2:
Open the loopfiles.ps1 file and paste the following and save it:
############################
$fso = new-object -com scripting.filesystemobject
$folder = $fso.getfolder("C:\temp")
foreach ($f in $folder.files) {
$f.path >> filesvisited.txt
$c = Get-Content $f.path
}
############################
Step 3:
Right click on the loopfiles.ps1 and select Run with Powershell.
At the end, one should have an output file (filesvisited.txt) with the names of the files in the current folder.