How To Split Paths // EP 04 // Efficient & Automatic File Management With PowerShell

Опубликовано: 11 Апрель 2026
на канале: Go Cloud Easily
958
10

In this Video, We will discuss about how to split path using PowerShell.

Commands that have been used in this Video are mentioned below, you can please use them for Practice PowerShell.

Prepare Demo Environment

Set-Location "D:\OneDrive - Hitachi Group\Documents\PSTraining\PracticeGround"
Remove-Item .\* -Recurse -Force
1..5|% {New-Item -Path . -Name "$("file" + "$_").txt" -ItemType "file"}

**** Examples ***********

1 Split a path using PowerShell to get Parent part Only using -Parent parameter
Split-Path -Path D:\PSTraining\PracticeGround\File1.txt -Parent

2 Get the qualifier/Drive of a registry path using PowerShell
Split-Path -Path "HKCU:\Software\Microsoft" -Qualifier

3 Get the qualifier/Drive of a path using PowerShell
Split-Path -Path D:\PSTraining\PracticeGround\File1.txt -Qualifier

4 Get the path without the qualifier using using PowerShell
Split-Path -Path D:\PSTraining\PracticeGround\File1.txt -NoQualifier

5 Get topmost file/folder name in mentioned path using PowerShell
Split-Path -Path D:\PSTraining\PracticeGround\File1.txt -Leaf

6 Display Leaf (Right most file/folder of the path) name using PowerShell
Split-Path -Path ".\*.txt" -Leaf -Resolve

7 Use -LiteralPath parameter to specify exactly same path as typed
Split-Path -LiteralPath .\file1.txt -Resolve

8 Get the parent folder using PowerShell
Split-Path -Path .\file1.txt -Resolve

9 Determines whether a path is absolute or not using PowerShell
Split-Path -Path .\file1.txt -IsAbsolute
Split-Path -Path D:\PSTraining\PracticeGround\File1.txt -IsAbsolute

************************************************************************
************************************************************************
Join Me on --
Facebook Group
  / mylearningsonline  
Facebook Page
  / mylearningsonline  
YouTube Channel
   / mylearningsonline  

**************************************************************************
#PowerShell #PowerShellScripting #PowerShellForBeginners #learnPowerShell​ #PowerShelltraining​ #PowerShellTutorial #MyLearningsOnline #SplitPathUsingPowerShell

PowerShell Scripting for Beginners
PowerShell Tutorial for Beginners
PowerShell Full Course
PowerShell Training for Beginners
How to Split Path Using PowerShell
Path Split in PowerShell