Powershell Variable assigning issue

Viewed 21

I am attemping to make the Destination from the Copy Item function be the $path and keep running into syntax error.

Function movefiles($dayhash){
    foreach ($h in $dayhash.GetEnumerator() )
    {
        $path = "$formsfolderDaily Checklists\$today_($h.Value)"
        Copy-Item $formsfolder$($h.Value) -Destination $formsfolder"Daily Checklists\"$today"_"$($h.Value)
        editDate($path)
    }

Desired outcome

I am attemping to make the Destination from the Copy Item function be the $path and keep running into syntax error.

Function movefiles($dayhash){
    foreach ($h in $dayhash.GetEnumerator() )
    {
        $path = $formsfolder + "Daily Checklists\" + $today + "_" + ($h.Value)
        Copy-Item $formsfolder$($h.Value) -Destination $path
        editDate($path)
    }
0 Answers
Related