从 GIthub-actions 运行时 Powershell Invoke-Expression 抛出错误

发布于 2025-01-13 09:00:55 字数 1013 浏览 5 评论 0原文

我正在从 PowerShell 运行 jf.exe,它不起作用并抛出以下错误,尝试了多种方法(在代码中注释),下面似乎没有任何效果,EXE“jf.exe:存在于完全相同的位置

   At C:\Program Files\actions-runner\_work\_temp\62db6136-4c6a-45db-9d86-865e38a2797b.ps1:4 char:33
 + "E:\Program Files\JFrog\jf.exe" rt ping
 +                                 ~~
Unexpected token 'rt' in expression or statement.
+ CategoryInfo          : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : UnexpectedToken

  Error: Process completed with exit code 1.




  name: Build
  on:
   workflow_dispatch

 jobs:
  build:
   name: Build
   runs-on: [self-hosted,X64,dev,Windows]
   steps:
    - uses: actions/checkout@v2
    - run: |
      # Ping the server
      #$cmd = "E:\Program Files\JFrog\jf.exe rt ping"
      #Invoke-Expression -Command "& 'E:\Program Files\JFrog\jf.exe' rt ping"
      #Invoke-Expression -Command "& '$cmd'"
      [string]$JFExe = "E:\Program Files\JFrog\jf.exe"
      [Array]$arguments = "rt", "ping"
      & $JFExe $arguments
    

I'm running jf.exe from PowerShell and its not working and throwing below error, have tried multiple ways (commented in the code) below nothing seem to work, the EXE"jf.exe: exists in the exact same location

   At C:\Program Files\actions-runner\_work\_temp\62db6136-4c6a-45db-9d86-865e38a2797b.ps1:4 char:33
 + "E:\Program Files\JFrog\jf.exe" rt ping
 +                                 ~~
Unexpected token 'rt' in expression or statement.
+ CategoryInfo          : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : UnexpectedToken

  Error: Process completed with exit code 1.




  name: Build
  on:
   workflow_dispatch

 jobs:
  build:
   name: Build
   runs-on: [self-hosted,X64,dev,Windows]
   steps:
    - uses: actions/checkout@v2
    - run: |
      # Ping the server
      #$cmd = "E:\Program Files\JFrog\jf.exe rt ping"
      #Invoke-Expression -Command "& 'E:\Program Files\JFrog\jf.exe' rt ping"
      #Invoke-Expression -Command "& '$cmd'"
      [string]$JFExe = "E:\Program Files\JFrog\jf.exe"
      [Array]$arguments = "rt", "ping"
      & $JFExe $arguments
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文