'Clear Contents of File from cmd
I have a file named testFile.js. js file contains some javascript code. I wanted to know how do I delete the file content alone from command Prompt (Windows).What is the command I should use?
Thanks :)
Solution 1:[1]
Try this at the command prompt assuming you're already in the directory containing the file.
echo.> testFile.js
Solution 2:[2]
Instead of my previous answer try this.
del testFile.js
COPY CON testFile.js
You will get just a blinking cursor. Press F6 and then enter. Your zero byte file will be created.
Solution 3:[3]
This will clear the file completely:
TYPE NUL > testFile.js
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Difster |
| Solution 2 | Difster |
| Solution 3 | Bob |
