My code is:
$path = "c:\no-such-dir\00.txt"
"foo" | Out-File -force -filePath $path
The error:
Out-File : Could not find a part of the path 'C:\no-such-dir\00.txt'
help out-file -full
For example, Force will override the read-only attribute or create directories to complete a file path, but it will not attempt to change file permissions.
So it seems it should create 'no-such-dir', but it does not. What happens?