I have googled for the below question, but could not find any answer. Can someone help me on this; What is the command to create a new file through Windows Powershell?
To create file using echo
echo some-text > filename.txt
Example:
C:\>echo This is a sample text file > sample.txt
C:\>type sample.txt
This is a sample text file
C:\>
To create file using fsutil
fsutil file createnew filename number_of_bytes
Example:
fsutil file createnew sample2.txt 2000
File C:\sample2.txt is created
C:\data>dir
01/23/2016 09:34 PM 2,000 sample2.txt
C:\data>
Limitations
Fsutil can be used only by administrators. For non-admin users it throws up below error.
c:\>fsutil file /?
The FSUTIL utility requires that you have administrative privileges. c:>
Hope this helps!