【问题标题】:Using .bat to launch a powershell script使用 .bat 启动 powershell 脚本
【发布时间】:2012-06-08 12:21:33
【问题描述】:

我可以在 powershell 中成功执行以下脚本,但是当我尝试从 .bat 运行脚本时,我不成功。.bat 文件是否以某种方式调用 powershell 脚本,因为它一直失败。 我将如何创建一个 .bat 脚本来运行下面的 powershell 脚本。

cd 'Program Files (x86)\Citrix \XenApp \ServerConfig' .\XenAppConfigConsole.exe /ExecutionMode:Join /FarmName:xencity /OdbcUsername:chris /odbcPassword:Jahner0 /DsnFile:"C:\xencitylifeSQLDS.dsn"

请大家帮忙 非常感谢

【问题讨论】:

    标签: batch-file powershell-3.0


    【解决方案1】:

    您可以通过将powershell 放在命令开头来做到这一点

    powershell cd 'Program Files (x86)\Citrix \XenApp \ServerConfig' .\XenAppConfigConsole.exe /ExecutionMode:Join /FarmName:xencity /OdbcUsername:chris /odbcPassword:Jahner0 /DsnFile:"C:\xencitylifeSQLDS.dsn"

    这只是调用 powershell 并给它你的运行命令,除了你在 cmd 中运行它。

    【讨论】:

      猜你喜欢
      • 2010-12-20
      • 1970-01-01
      • 2017-11-01
      • 2019-06-16
      • 1970-01-01
      • 2011-09-19
      • 2012-11-04
      • 2017-02-02
      • 1970-01-01
      相关资源
      最近更新 更多