You mean something like this?
$vmlist=Get-Content C:\vm.txt
foreach($vminGet-VM-Name $vmlist){
$hd=Get-HardDisk-VM $vm| select -First 1
$dsName=$hd.Filename.Split('/')[0].TrimStart('[')
New-HardDisk-VM $vm-CapacityGB 10-Datastore $dsName-storageFormat $hd.StorageFormat
}