PowerShell code below shows how to work or play with files and folders. #Get the file name only using “.BaseName” $FileNameOnly = ( Get-ChildItem -File -Path "C:\temp\" ) . BaseName #Get the full path of the file using “.FullName” $Full_Path = ( Get-ChildItem -File -Path "C:\temp\" ) . FullName #Get the parent folder of the path of the file using “.DirectoryName” $ParentFolder = ( Get-ChildItem -File -Path "C:\temp\" ) . DirectoryName #Get the file with the extension using “.Name” $FileName_withExtension = ( Get-ChildItem -File -Path "C:\temp\" ) . Name `n – starts a new line after the current line Write-Output "FileNameOnly: $FileNameOnly `n" Write-Output "Full_Path: $Full_Path `n" Write-Output "ParentFolder: $ParentFolder `n" Write-Output "FileName_with_Extension: $FileName_withExtension `n" Write-Output "**********`n" ...
Make the world a better place by sharing knowledge, ideas and anything that you can give that comes from the heart.