How to convert an object to a string?
问题 I want to assign the name of the current directory to construct the path of a parallel directory (to run some diff commands). However when I do this: New-Item -ItemType Directory -Name my_test_dir; Set-Location my_test_dir; $a = $( Get-Item . | Select-Object Name ); write-host( "x${a}x" ); I get x@{Name=my_test_dir}x instead of what I expected : xmy_test_dirx So, how do I "unbox" the name of the directory? PS - for ease of testing I use: mkdir my_test_dir; cd my_test_dir; $a = $( Get-Item . |