Windows PowerShell 变量中的空格无法继续

Whitespace in Windows PowerShell variables can't proceed

我有以下 PowerShell 脚本:

$HPLOCONS = "C:\Users\i\OneDrive - A\Documents\A\ILOstuffs\HPLOCONS.exe"
$FilePath = "C:\Users\i\OneDrive - A\Documents\A\ILOstuffs\ilo.txt"
$iLOUser = "uid"
$iLOPass = "PW"

$iLOs = Get-Content $FilePath;
echo "Number of iLOs ="$iLOs.Count;
echo $iLOs | Out-GridView

foreach ($iLO in $iLOs) {
    Invoke-Expression "$HPLOCONS -name $iLOUser -password $iLOPass -addr $iLO"
}

自从我移至 OneDrive 后,无法处理 $HPLOCONS$Filepath 中的 space。它在抱怨space。 我怎样才能逃脱它?我试了很多方法都没用。

Invoke-Expression IS EVIL. DO NOT USE IT.

改用call operator

& $HPLOCONS -name $iLOUser -password $iLOPass -addr $iLO