我无法通过Powershell脚本直接执行bat文件。例如,这在命令行上有效:
.\\my-app\my-fle.bat
当我将此命令添加到脚本时,它输出:
The term '.\\my-app\my-file.bat' 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.
我也尝试了以下操作,结果相同:
& .\\my-app\my-fle.bat
& ".\\my-app\my-fle.bat"
\my-app\my-fle.bat
& \my-app\my-fle.bat
& "\my-app\my-fle.bat"
注意:它必须返回lastexitcode,因为我需要验证批处理是否成功。