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:
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
Post a Comment