This script is supposed to create a file or files and if there is more than 1 put 1 after name then 2 then 3 and so on.. and if its 0 or less to say: You must select at least one file to be created
$Filename=Read-Host "Enter desired filename"
$NewFilePath=Read-Host "Enter desired path"
$AmtOfFiles=Read-Host "Enter desired amount of files"
if($AmtOfFiles -ge 1){
for($AmtOfFiles=1;$AmtOfFiles -gt 0){
New-Item -ItemType file -Path $NewFilePath -Name $Filename$i
$i++
}
}
else{Write-Output "You must select at least one file to be created.”}```
Get-Help about_For. the examples make your "endless loop" problem quite clear. [grin]