powershell - How to create a directory and file while concatenating path and file name? -


in this question discovered following:

$woo = "c:\temp" $hoo = "shabang" new-item -itemtype file (join-path $woo $hoo) 

works great only under assumption path ($woo) exists. when think of it, makes sense since i'm creating file not directory.

how can create both? credit if there's nifty way create each 1 (directory , file, respectively) when exist.

the solution quite simple. add -force flag:

new-item -itemtype file -force (join-path $woo $hoo) 

this create new file , many new directories needed. note still need write permissions parent directory.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -