DirGetParent

Retrieve parent directory for a file or folder.


OutputVar := DirGetParent(Path , ParentCount)
Function Example: ParentDir := DirGetParent(A_AhkPath)

Parameters

OutputVar

The name of the variable in which to store the parent directory.

Path

Path to a directory or File, the path must exist.

ParentCount (optional)

By default (ParentCount = 1) parent directory is retrieved, to retrieve parent of parent use 2 and so on.

General Remarks

If there is no parent directory, empty string will be returned.

Examples

MsgBox % DirGetParent(A_AhkPath)