运行 来自 Azure WebJob 运行.ps1 的 exe

Run an exe from the run.ps1 of an Azure WebJob

我正在尝试在 Azure 门户中进行部署。部署完成后,它将以 powershell 脚本启动,该脚本将启动位于同一目录中的可执行文件

运行.ps1(脚本)的内容

& ScrapperProcessor.exe

其中 "ScrapperProcessor.exe" 是可执行文件的名称。

"run.ps1" 和 "ScrapperProcessor.exe" 的父文件夹名为 "Debug"

我得到以下日志:

[01/08/2018 06:27:52 > f328c1: SYS INFO] Status changed to Initializing
[01/08/2018 06:27:58 > f328c1: SYS INFO] Run script 'run.ps1' with script host - 'PowerShellScriptHost'
[01/08/2018 06:27:58 > f328c1: SYS INFO] Status changed to Running
[01/08/2018 06:28:07 > f328c1: ERR ] & : The term 'ScrapperProcessor.exe' is not recognized as the name of a 
[01/08/2018 06:28:07 > f328c1: ERR ] cmdlet, function, script file, or operable program. Check the spelling of the 
[01/08/2018 06:28:07 > f328c1: ERR ] name, or if a path was included, verify that the path is correct and try again.
[01/08/2018 06:28:07 > f328c1: ERR ] At D:\local\Temp\jobs\triggered\Scr7\xbs0kgzn.2e4\Debug\run.ps1:1 char:3
[01/08/2018 06:28:07 > f328c1: ERR ] + & ScrapperProcessor.exe
[01/08/2018 06:28:07 > f328c1: ERR ] +   ~~~~~~~~~~~~~~~~~~~~~
[01/08/2018 06:28:07 > f328c1: ERR ]     + CategoryInfo          : ObjectNotFound: (ScrapperProcessor.exe:String) [ 
[01/08/2018 06:28:07 > f328c1: ERR ]    ], CommandNotFoundException
[01/08/2018 06:28:07 > f328c1: ERR ]     + FullyQualifiedErrorId : CommandNotFoundException
[01/08/2018 06:28:07 > f328c1: ERR ]  
[01/08/2018 06:28:07 > f328c1: SYS INFO] Status changed to Success

知道为什么这不起作用吗?

您只需更改:

& ScrapperProcessor.exe

& .\ScrapperProcessor.exe