我想分配当前目录的名称来构造并行目录的路径(运行一些 diff 命令)。
但是,当我这样做时:
New-Item -ItemType Directory -Name my_test_dir;
Set-Location my_test_dir;
$a = $( Get-Item . | Select-Object Name );
write-host( "x${a}x" );
我明白了
x@{Name=my_test_dir}x
而不是我所期望的:
xmy_test_dirx
那么,我如何“拆箱”目录的名称呢?
PS - 为了便于测试,我使用:
mkdir my_test_dir; cd my_test_dir; $a = $( Get-Item . | Select Name ); echo "x${a}x"; cd ..; rmdir my_test_dir