shell - Import-CSV cmdlet in powershell -
got problem powershell script.
the import-csv cmdlet not working want it...
what want do? - import single names out of 1 column header "name" create paths.
name jack thomas john
this code function:
$users = import-csv -path "$csvpath" -header "name" $path = ("d:\users\" + $users) foreach ($user in $users) {write-host $path}
but output i'm getting "d:\users\"
i'm not pro in coding can't see failure :d
new update:
$users = import-csv -path "$csvpath" -header "name"
changed :
$users = import-csv -path "$csvpath"
you can not $path, because $users not string.
$path = ("d:\users\" + $users)
instead, can this
foreach ($user in $users) {$path = "d:\users\" + $user ; write-host $path}
but think want this:
foreach ($user in $users) {$path = "d:\users\" + $user.name ; write-host $path}
==================================================
this works in pc. further information?
Comments
Post a Comment