【发布时间】:2013-02-16 03:41:34
【问题描述】:
这不返回任何内容:
$x = "C:\temp"
Start-Job -ScriptBlock {get-childItem -path $x} | Wait-Job | Receive-job
但是提供不带变量的路径参数,像这样......
Start-Job -ScriptBlock {get-childItem -path C:\temp} | Wait-Job | Receive-job
...返回该临时文件夹的内容,在本例中为 durrr.txt。这是在 Windows Server 2008R2 SP1 上,Powershell $host.version 输出如下:
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1
怀疑 Powershell 的 v3,我尝试将 Windows 7 SP1 桌面从 v2 更新到 v3,但没有运气重现问题。在升级后的桌面上,$host.version 输出现在与上述匹配。
发生了什么事?
编辑/发生了什么?
被破坏的工作似乎等同于
Start-Job -ScriptBlock {get-childItem -path $null} | Wait-Job | Receive-job
所以 gci 返回了后台作业当前目录的结果,Documents 文件夹恰好是空的。
【问题讨论】:
标签: powershell powershell-3.0 get-childitem powershell-jobs