I need to use the FileSystem provider and using an appropriate cmdlet, create a zero-lenght file name C:\Zero.txt. I know I need to use New-Item within it.

Any ideas?

  • I used at the PS D:\> prompt
    – Steve B
    Mar 1, 2016 at 0:26
  • new-item -path c:\ -name zero.txt -type file it created it and now I am trying to change the name of the file to TESTING and can't formulate the syntax
    – Steve B
    Mar 1, 2016 at 0:27
  • Please add those to proper code blocks in your question.
    – EEAA
    Mar 1, 2016 at 0:30
  • PS D:\> new-item -path c:\name zero.txt -type file
    – Steve B
    Mar 1, 2016 at 0:33
  • 2
    Is this homework, by any chance?
    – MDMarra
    Mar 1, 2016 at 1:00

1 Answer 1


I may be misunderstanding the question, especially since you've effectively already answered it yourself in the comments.

In order to create a empty file (zero length) with the name zero.txt, you can use the command:

New-Item -Path C:\ -Name zero.txt -Type File

You mentioned wanting to rename it in the comments, to do which you can use Rename-Item:

Rename-Item -Path C:\zero.txt -NewName TESTING

Of course, you can skip the rename by just creating the file with the desired name right away:

New-Item -Path C:\ -Name TESTING -Type File

Not the answer you're looking for? Browse other questions tagged or ask your own question.