Welcome › Forums › General PowerShell Q&A › new-item extra output
This topic contains 4 replies, has 4 voices, and was last updated by
when using the new-item cmdlet it gives the output of what appears to be get-childitem. Is this normal,
PS C:\Users\shane> New-Item -type file test.txt
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 8/7/2015 9:30 PM 0 test.txt
how would I supress this output?
The documentation for New-Item (man New-Item) don't seem to provide any way of doing this, so short of piping the command to Out-Null I'm not sure what other options are available- though perhaps others on here do.
PS C:\Users\shane> New-Item -type file test.txt | Out-Null
Thanks for the answer.
I feel like it did not give me all the output in the other past times I ran it, only some of the times. I am feeling a bit crazy.
New-Item -Type File -Name test1.txt | Out-Null
[void](New-Item -Type File -Name test2.txt)
New-Item -Type File -Name test3.txt > $null
$nf = New-Item -Type File -Name test4.txt
can all be used to mask output. I prefer the first one
$null = New-Item -Type File -Name test1.txt -Path C:\temp -Force
The topic ‘new-item extra output’ is closed to new replies.