Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launching PowerShell Script from Eclipse IDE

I'm trying to run a Powershell script without leaving Eclipse IDE so I setup External tool config as follows:

under "main" tab:

Location: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe

Working Directory: C:\WINDOWS\system32\windowspowershell\v1.0\

Arguments: "& C:\PowershellScripts\script.ps1"

I save it and click run but nothing happens. A console window stays open diplaying C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe in title. I click on red Stop button but noting seems to happen anyway. The script is not exectued.

What am I missing?

like image 683
Mrchief Avatar asked Jan 06 '10 19:01

Mrchief


1 Answers

I would probably use the -file argument, as in

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

you may need to set the execution policy first if it's not already set to unrestricted on your system.

On my machine, a Windows 7 64-bit box with 64-bit Eclipse and a 64-bit jdk (1.6), I am able to get things to work if I set the "arguments" field to:

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

An alternative that also worked for me was:

Set the application to launch as C:\Windows\System32\cmd.exe Set the arguments field to something like:

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

That does seem excessively Rube Goldbergian to me, but it's worth a try to see if your problems can be worked around by using a normal shell.

I did briefly get symptoms similar to what you describe, but I can't reproduce them anymore.

like image 195
JasonTrue Avatar answered Oct 31 '22 21:10

JasonTrue