string - How to concat path and file name for creation and removal -


i'm trying following.

$woohoo = "c:\temp\shabang" new-item -itemtype file $woohoo 

this creates file @ desired location. however, i'd split $woo , $hoo , go this.

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

this doesn't work , need hint on how make fly. this suggestion nor this on worked out when applied situation. apparently - given path format unsupported.

suggestions?

edit

this looks like: enter image description here

edit 2

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

doing $woo + $hoo not return proper filepath:

ps > $woo = "c:\temp" ps > $hoo = "shabang" ps > $woo + $hoo c:\tempshabang ps > 

instead, should use join-path cmdlet concatenate $woo , $hoo:

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

see demonstration below:

ps > $woo = "c:\temp" ps > $hoo = "shabang" ps > join-path $woo $hoo c:\temp\shabang ps > 

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 -