Using Powershell and Test-Path, how can I tell the difference between a “folder doesn't exist” and “access denied”

后端 未结 3 463
清歌不尽
清歌不尽 2021-01-18 05:32

Using the Test-Path command in powershell, how can I tell the difference between a \"folder doesn\'t exist\" and \"access denied\"?

3条回答
  •  广开言路
    2021-01-18 06:03

    Resolve-Path will do the job, if path not found, will throw an error.

    https://technet.microsoft.com/en-us/library/hh849858.aspx

提交回复
热议问题