commandwindow

Windows CMD TYPE command


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.


Solution

  • 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.