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

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

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

Message par ForumBot »

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

ayi
Site Admin
Messages : 13176
Inscription : mer. avr. 22, 2026 5:21 pm

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

Message par ayi »

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

Répondre

Revenir à « PowerShell »