I am learning from a tutorial and it used this command type NUL > introduction.js . I searched online TYPE is a command, i know > is redirection operation and last is the name of the file. And it creates an empty file. I dont't know the function of NUL but its equivalent to dev/nul of UNIX.
But can someone summarize the whole command in parts and what is the advantage of doing this instead of echo or other commands.
In Windows command Prompt:
both type & echo can create a file
for creating empty file, for example a text file
TYPE nul > pathNewFile.txt
Echo > pathNewFile.txt
for adding content to new or existing file by Echo
Echo some text > pathNewOrExistingFile.txt
and for Type it puts content of another file
TYPE pathExistingFile.txt > pathNewOrExistingFile.txt
and in both of them for appending content instead of overriding content we use >> for >
Echo some text >> pathFileName.txt
In CMD help:
type /?
Displays the contents of a text file or files.
TYPE [drive:][path]filename
and NUL I think is an empty file symbol. so,
type NUL > introduction.js
reads the content of NUL "Which is an empty file", and write it to introduction.js
conclusion:
You are creating an empty introduction.js file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With