ItemCmdletProvider.ItemExists(String) Method

Definition

Determines if an item exists at the specified path.

protected:
 virtual bool ItemExists(System::String ^ path);
protected:
 virtual bool ItemExists(Platform::String ^ path);
 virtual bool ItemExists(std::wstring const & path);
protected virtual bool ItemExists (string path);
abstract member ItemExists : string -> bool
override this.ItemExists : string -> bool
Protected Overridable Function ItemExists (path As String) As Boolean

Parameters

path
String

The path to the item to see if it exists.

Returns

True if the item exists, false otherwise.

Remarks

Providers override this method to give the user the ability to check for the existence of provider objects using the set-item cmdlet.

Providers that declare ProviderCapabilities of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those requirements by accessing the appropriate property from the base class.

The implementation of this method should take into account any form of access to the object that may make it visible to the user. For instance, if a user has write access to a file in the file system provider bug not read access, the file still exists and the method should return true. Sometimes this may require checking the parent to see if the child can be enumerated.

The default implementation of this method throws an PSNotSupportedException.

Applies to