function Move-Item2 { param ($file) Try { $file = Get-Item -Path $file -ErrorAction Stop } Catch { write-host "error" } IF ($file.Extension) { write-host "ext" } ELSE { write-host "no ext" } } Move-Item2 -file E:\bwtserver.txt #copy-item step- check- get-verb