Read-Host – accept valid path and filename only?

by Sep 1, 2017

Good Morning,

I currently have this line:

Do {$Executable = Read-Host "What executable (including the path) do you want copy and run on the remote system"} Until (Test-Path $Executable)

How can I improve it so that it will only accept a valid path with a filename please? Like:


but not


Thanks very much for any help you can provide.