我有一个 powershell 脚本(test.ps1),我想从批处理文件中运行它。批处理文件包含以下内容:
PowerShell –Command “& ‘.\test.ps1’” 001
pause
当我在 32 位 Windows 7 机器上运行批处理文件(以管理员身份)时,powershell 脚本运行成功。当我尝试在 64 位 Windows 7 机器上运行它时,我收到以下错误:
C:\Windows\system32>PowerShell –Command “& ‘.\test.ps1’” 001
The term ‘.\test.ps1’ is not recognised as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if the path was included, verify that the path is correct and try again.
At line:1 char:2
+ & <<<< ‘.\test.ps1’ 001
+ CategoryInfo : ObjectNotFound: (.\test.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorID : CommandNotFoundException
有任何想法吗?
谢谢