Reputation: 95
I know how to create a folder in the terminal of vsc mkdir NameOfFolder
, but how to create a file in the terminal?
Upvotes: 4
Views: 32195
Reputation: 1
Upvotes: 0
Reputation: 1
On Windows Powershell, use New-Item -Path . -Name "testfile1.txt"
. This creates a text file that is named testfile1.txt. You can also check out the Microsoft website for more information.
Upvotes: 0
Reputation: 598
$ touch example.py (if using bash)
echo "# This is an example PowerShell script" > example.py (if using PowerShell)
Upvotes: 1
Reputation: 11
Once you are in the desired directory in VSCode terminal, use touch file_name.file_extension
Eg: touch README.md
. It works just like LINUX.
Upvotes: 1
Reputation: 549
Just type square bracket ">" and name in the bash terminal of VScode:
> fileName.txt
Upvotes: -1
Reputation: 136
You can also use:
code filename.filetype
This also works with directories
code app/program.py
This wil open the new file in te editor (if the filetype allows it) and then you can just save it.
Upvotes: 10
Reputation: 142
Ctrl + ` to open the terminal in Visual Studio Code.
echo > "File.txt"
to create a new .txt
file in the current directory.
Upvotes: 11