COMMAND EVERYTHING.
Extract a filename from a path string without reading or modifying the file.
PowerShell · Risk: Low · Documentation VerifiedLast verified: 2026-10-26
Returns app.log. This example manipulates a path string and does not verify that the file exists.
Split-Path [-Path] <String[]> [-Parent] [-Resolve] [-Credential <PSCredential>]
[<CommonParameters>]Copied 0 timesNo elevation is required for the in-memory examples. Filesystem operations require read or traversal access to the selected path.
PowerShell · 7.6; filesystem examples require the FileSystem provider
-LeafPowerShell 7.6 with Microsoft.PowerShell.Management. For file examples, replace the sample path with an accessible file or directory.
Low risk for the supplied example. Protect file contents, paths, and returned system metadata. Review any modifications to the example before execution.
Split-Path -Path '/var/log/app.log' -LeafReturns app.log. This example manipulates a path string and does not verify that the file exists.
Sign in to keep your own command reference lists.
Explain or customize this command with AI