Powershell打印奇怪的价值观

时间:2013-05-17 06:17:46

标签: powershell

我的powershell脚本时不时地打印出蓝色。我重新检查了很多次,而且我没有打印这个功能或脚本。如果有这个,请有人帮助我 是PowerShell的预期行为吗?

PSPath            : Microsoft.PowerShell.Core\FileSystem::\\SOMEDIR\
PSParentPath      : Microsoft.PowerShell.Core\FileSystem::\\SOMEDIR\
PSChildName       : SOMEFILENAME
PSProvider        : Microsoft.PowerShell.Core\FileSystem
PSIsContainer     : True
Name              : SOMEFILENAME
Parent            : Archieve
Exists            : True
Root              : \\SOMEDIR
FullName          : \\SOMEDIR\
Extension         :
CreationTime      : 17/05/2013 4:05:15 PM
CreationTimeUtc   : 17/05/2013 6:05:15 AM
LastAccessTime    : 17/05/2013 4:05:15 PM
LastAccessTimeUtc : 17/05/2013 6:05:15 AM
LastWriteTime     : 17/05/2013 4:05:15 PM
LastWriteTimeUtc  : 17/05/2013 6:05:15 AM
Attributes        : Directory
BaseName          : SOMEFILENAME
Mode              : d----

以下是可疑的PowerShell代码段:

foreach ($file in Get-ChildItem $path*.* -Include *.csv){ 

        if (!(Test-Path $archieveFolder) )
        {
            #1. Create config archieve directory
            New-Item -Path $archieveFolder -Force -ItemType Directory
        }
}

1 个答案:

答案 0 :(得分:6)

New-Item输出它创建的项目。如果您不想要它,请转换为[Void]或将其传递给Out-Null。

New-Item -Path $archieveFolder -Force -ItemType Directory | Out-Null