In PowerShell is there an equivalent of touch
?
For instance in Linux I can create a new empty file by invoking:
touch filename
On Windows this is pretty awkward -- usually I just open a new instance of notepad and save an empty file.
So is there a programmatic way in PowerShell to do this?
I am not looking to exactly match behaviour of touch, but just to find the simplest possible equivalent for creating empty files.
Answer
Using the append redirector ">>" resolves the issue where an existing file is deleted:
echo $null >> filename
No comments:
Post a Comment