在 Windows PowerShell 中檢查一個檔案是否存在

在 Windows PowerShell 中檢查一個檔案是否存在

有時,你會收到一條錯誤訊息,指出該檔案在 PowerShell 中不存在。本教程將介紹四種方法來檢查 PowerShell 中是否存在檔案。 使用 Test-Path 檢查 PowerShell 中是否存在檔案 第一種方法是 Test-Path cmdlet。它確定完整路徑是否存在。如果路徑存在則返回 $True,如果缺少任何元素則返回 $False。-PathType Leaf 引數檢查檔案而不是目錄。

Tags

PowerShell Array PowerShell String PowerShell File PowerShell Copy PowerShell Object PowerShell Statement PowerShell Folder PowerShell Registry PowerShell Script PowerShell JSON PowerShell Service PowerShell User PowerShell XML PowerShell Color PowerShell Command PowerShell Directory PowerShell Variable PowerShell CSV PowerShell DateTime PowerShell Path PowerShell Operator

最受歡迎文章

最近更新的文章