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?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityI 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 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