I try to create a folder and a file in one PowerShell command: I tried:
New-Item hello\test\ (New-Item hello\test\file.txt -type file) -type directory -Force
and
New-Item file.txt (New-Item hello\test\ -type direcotry) -type file -Force
But both don't seem to work as expected.
What I want to achieve is one command to create hello\test\file.txt
Just provide the filepath you want, including the directory, and it will work:
New-Item -Path '.\hello\test\file.txt' -ItemType File -Force