Hacker News new | ask | show | jobs
by dahauns 73 days ago

  $file = Get-ChildItem "C:\some path\having spaces.txt"

  Write-Output $file.DirectoryName
  Write-Output $file.Name
  Write-Output $file.BaseName
Or if that's still to verbose:

  $file = gci "C:\some path\having spaces.txt"

  echo $file.DirectoryName
  echo $file.Name
  echo $file.BaseName

People should really get over their aversion against powershell.
1 comments

You could just one line it too:

  Get-Item "C:\some path\having spaces.txt" | select DirectoryName, Name, Basename