gpt4 book ai didi

eclipse - 从 Eclipse IDE 启动 PowerShell 脚本

转载 作者:行者123 更新时间:2023-12-02 16:57:04 54 4
gpt4 key购买 nike

我尝试在不离开 Eclipse IDE 的情况下运行 Powershell 脚本,因此我按如下方式设置外部工具配置:

在“主”选项卡下:

位置: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe

工作目录: C:\WINDOWS\system32\windowspowershell\v1.0\

参数:“& C:\PowershellScripts\script.ps1”

我保存它并单击“运行”,但没有任何反应。控制台窗口保持打开状态,标题中显示 C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe。我单击红色“停止”按钮,但注意到似乎无论如何都会发生。脚本未执行。

我错过了什么?

最佳答案

我可能会使用 -file 参数,如

-file "C:\PowershellScripts\script.ps1"

如果您的系统上尚未将执行策略设置为无限制,您可能需要先设置执行策略。

在我的机器上,一个带有 64 位 Eclipse 和 64 位 jdk (1.6) 的 Windows 7 64 位机器,如果我将“arguments”字段设置为:

-executionpolicy unrestricted -file "c:\code\test.ps1"

对我也有效的替代方案是:

将应用程序设置为以 C:\Windows\System32\cmd.exe 启动将参数字段设置为如下所示:

/c "powershell -executionpolicy unrestricted -file c:\code\test.ps1"

对我来说,这确实显得过于鲁布·戈德堡式的,但值得一试,看看是否可以通过使用普通的 shell 来解决您的问题。

我确实短暂地出现了与您描述的类似的症状,但我无法再重现它们。

关于eclipse - 从 Eclipse IDE 启动 PowerShell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2015434/

54 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com