Powershell 脚本无法识别绝对文件路径

Powershell script cannot recognize absolute file path

我有一个 windows 命令脚本需要 运行 在另一个位置的另一个 powershell 脚本。 windows 命令脚本包含以下代码:

powershell -NoProfile -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; & "C:\Users\Tommy\AppData\bootstrap\bootstrap.ps1" -Update"

当我运行 windows 命令脚本时,它总是显示以下错误:

& : The term 'C:\Users\Tommy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

在line:1char:53

我试过在绝对文件路径的前面加点,但没用。

尝试将 "C:\Users\Tommy\AppData\bootstrap\bootstrap.ps1" 更新为 'C:\Users\Tommy\AppData\bootstrap\bootstrap.ps1'。您再次使用双引号提前结束了报价。

powershell -NoProfile -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; & 'C:\Users\Tommy\AppData\bootstrap\bootstrap.ps1' -Update"