skip to Main Content

How to create index.js or any file using terminal in vscode or cmd ?
I have tried touch index.js but it is not recognised by my terminal in windows 10
Please help me with this

enter image description here

I have tried touch index.js but it is not recognised by my terminal in windows 10
Please help me with this

enter image description here

2

Answers


  1. In windows touch index.js will not work. this command works in UNIX based OS.

    try this instead..

    type nul > index.js
    
    Login or Signup to reply.
  2. Here, touch command works on Unix-based systems, and it’s native command, does not work on Windows, it works on macOS and Linux,

    You can use type command to create a new file. For example:

    type nul > index.js
    

    You can also use echo and copy command, but it’s only use in cmd, not in PowerShell. While type command work on both.

    Note: nul is a way to represent a nonexistent file or a file that doesn’t contain any meaningful data.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search