【问题标题】:Listeners installation监听器安装
【发布时间】:2015-12-10 18:15:26
【问题描述】:

我正在创建一个自动安装 Oracle 软件的 PowerShell 脚本。现在一切正常,直到我尝试为软件设置两个监听器。

手动安装数据库软件时,必须在安装软件后打开一个新的shell并执行这两个命令....

netca -silent -responsefile c:\path\to\netca_listener.rsp
netca -silent -responsefile c:\path\to\netca_callout_listener.rsp

我一直在尝试像这样执行这两个 rsp 文件..

saps -FilePath cmd.exe -ArgumentList "/c", "netca", "-silent", "-responsefile $first_rspfile" -WindowStyle Hidden -Wait 

通常,该进程会短暂旋转,但随后不会执行任何操作,并且响应文件会在进程开始运行时弹出打开。

关于可能发生的事情的任何线索?

【问题讨论】:

  • 路径$first_rspfile 是否包含空格?.....也许你需要用单引号括起来:"-responsefile '$first_rspfile'"
  • 不,$first_rspfile 不包含空格。我试过唱引号,但没有成功

标签: powershell cmd powershell-2.0


【解决方案1】:

您不需要在 PowerShell 中使用 cmd /c。试试这个:

Start-Process -FilePath "netca.exe" `
    -ArgumentList @("-silent", "-responsefile $first_rspfile") `
    -WindowStyle "Hidden" -Wait

【讨论】:

  • 我现在收到这个错误...Start-Process : This command cannot be executed due to the error: The system cannot find the file specified. At c:\path\to\modle.psm1:16 char:9 + saps <<<< -FilePath "netca" -ArgumentList "-silent", "-responsefile $first_rspfile" -WindowStyle Hidden -Wait + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
  • 那么,netca.exe 呢?如果它不在您的脚本所在的同一文件夹中,并且不在%path% 上的文件夹中,您需要指定完整路径(例如C:\folder\netca.exe)。
  • 感谢您的帮助!我必须获得.exe 的完整路径才能执行该过程。当手动尝试运行命令时,我通常会打开一个新的 shell 并运行命令,但是当它作为进程运行时,我必须映射路径。再次感谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多