DEV Community

Discussion on: Windows Commands CheatSheet you needed

Collapse
 
j471n profile image
Jatin Sharma

There are many ways you can do that:

echo. > script.js 
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file as Luke mentioned, but the file will be override by the empty if the file already exists.

type nul > filename.txt
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file, but the file will also be override by the empty if the file already exists.

type nul >> filename.txt
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file, but file will not be override by the empty file if the file already exists.

call >> filename.txt
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file, but file will not be override by the empty file if the file already exists.

New-Item script.txt
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file, but file will not be override by the empty file if the file already exists. (only works in Power Shell)

notepad index.html
Enter fullscreen mode Exit fullscreen mode

This command will create/open the file in notepad (not recommended)

$>>filename.js
Enter fullscreen mode Exit fullscreen mode

This command will give you ERROR ('$' is not recognized as an internal or external command,) but it will create a file (does not override the contents of the file already exists)

.>script.js
Enter fullscreen mode Exit fullscreen mode

This command will give you ERROR ('.' is not recognized as an internal or external command,) but it will create a file (it does override the contents if the file already exists)

There could be more, But I guess these are more than enough. If you ask me which one I use the it would be $>>filename.js .

I hope it helps.

Collapse
 
dendihandian profile image
Dendi Handian

wow thank you for this much help, I appreciate that 😁

Thread Thread
 
j471n profile image
Jatin Sharma

It's my pleasure 😊