Comment verifier si un fichier existe ou non dans Windows PowerShell ?

Comment verifier si un fichier existe ou non dans Windows PowerShell ?


Source : Stack Overflow [powershell]

Juste pour proposer l’alternative a la cmdlet Test-Path (puisque personne ne l’a mentionnee) :

[System.IO.File]::Exists($path)

Fait (presque) la meme chose que

Test-Path $path -PathType Leaf

sauf qu’il n’y a pas de prise en charge des caracteres generiques