I would like to understand why I'm receiving below error when I'm trying to create new empty file in VS Code terminal. See below:
type : Cannot find path '[FILE_PATH]\nul' because it does not exist.
At line:1 char:1
+ type nul > '[FILE_NAME]'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: ([FILE_PATH]\nul:String) [Get-Content], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
I am using Windows and I used:
type nul > '[FILE_NAME]'
It was pretty long name with spaces so that's why I used ''. Also funny thing is that the file was created but the error appears each time. Do you why this is happening and how to get rid of it? Do you recommend any other methods for creating empty files on Windows?
I was looking for an answer to this as well. I found out that you can just type echo > filename.txt and you would no longer get that error. Hopefully this helps you as well.
type NUL > filename.ext works for windows command prompt without throwing any error but in case of other terminals like powershell or any other it shows the above error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With