eclipse - 从 Eclipse IDE 启动 PowerShell 脚本

标签 eclipse powershell

我尝试在不离开 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/

相关文章:

powershell - 使用 Powershell 获取 Azure WebApp 的 PublishProfile

eclipse - Eclipse 是否有比内置工具更好的重构工具?

eclipse - 如何使用 EGit 在 Eclipse 中配置 GIT HTTPS 客户端证书身份验证?

html - Powershell 2.0 - 使用 HtmlAgilityPack 获取 FORM 元素的子元素

powershell - Windows Powershell:调用 “help”或其他无法识别的函数时出现错误消息

windows - 删除报表服务器(2014 native 模式)加密 key 和数据 [PowerShell]

java - 如何向 Eclipse Project Explorer 工具栏添加按钮?

java - 代码在 Debug模式下运行良好,但在正常运行时停止(eclipse)

java - 无法在自定义对话框中实现 setSingleChoiceItems

powershell - Azure PowerShell 自动化 "no default subscritpion has been designated"