0
我有一个脚本,应该创建一些文件夹,如果他们不存在。Powershell选择一个属性作为原始类型
"a","b","c" `
| select @{Name="path"; Expression={Join-Path "C:\temp" $_}} `
| select -ExpandProperty path `
| where { -Not (Test-Path $_)}
是否可以提取联接路径字符串更优雅,在新的对象将其分配给指定的属性path
,然后用另一种选择与-ExpandProperty?
我要查找什么呢%{}做 – Axarydax 2014-11-05 09:19:04
对不起,我已经开发了一下。 %是Foreach对象的别名。所以基本上对于数组中的每个元素(“a”,“b”,“c”),我们执行连接路径并对其进行测试。 – 2014-11-05 09:28:31