I'm having this code:
$Paths = 'C:\' , 'P:\' , "\\fril01\ufr$\$env:username"
$torEXE = Get-childitem -path $paths -recurse -Exclude $ExcludePaths -erroraction 'silentlycontinue' | where-object {$_.name -eq "Tor.exe"}
if ($torEXE.Exists) {$answer = 1}
To check for file tor.exe, but as you can see this check could take some time. the could be a chance the check will find tor.exe on the first few seconds but will continue checkink all the paths. i want it to halt immidietly after it found tor.exe and not continue searching for it. how can it be done?