无法使用变量启动 PowerShell ForEach 循环

Unable to Start a PowerShell ForEach Loop with a Variable

从下面的代码片段可以看出,我是 PowerShell 的新手。我正在尝试 运行 一个命令,该命令使用驱动器盘符的变量,工具来自 运行ning。我收到一个错误:

unexpected token in expression statement 'tools\perl_5.20.2.1\bin\perl.exe'

如果我对驱动器盘符进行硬编码,此脚本可以正常工作。有人可以建议另一种方法吗?

$OutDrive = Read-Host -Prompt 'Please select a drive letter to create output     folders (e.g. c:)'

$ntuser = Get-ChildItem -Force $outdrive\Folder$ComputerName-$Date\users |
      Where-Object {$_.PSIsContainer} | 
      foreach {$_.Name}

foreach ($Name in $ntuser){
    **$OutDrive\tools\perl_5.20.2.1\bin\perl.exe c:\tools\somescript**     $Outdrive\Folder$ComputerName-$Date\users$Name\ntuser.dat -f ntuser Out-File -   FilePath $Outdrive\FOlder$ComputerName-$Date\users$Name$Name-blah.txt
}
& "$OutDrive\tools\perl_5.20.2.1\bin\perl.exe" ......