Jul 9, 2014

PowerShell and Eclipse

I recently changed the location of my workspace on Eclipse and now the path to my projects contains a space.  Normally inside Eclipse when you have white space in a path variable  you just surround the variable name with double quotes, for example

“${workspace_loc}”

This works well for many things but it doesn’t make PowerShell happy, it still can’t handle the space. I found the key to the answer in creative use of the invoke operator &.  The parameter to the PowerShell command looked like this when I was done

 "& {&'"${workspace_loc}"\MyProjectDirectory\MyPsScript.ps1'}"

The full command then looked like:

powershell -executionpolicy RemoteSigned "& {&'"${workspace_loc}"\MyProjectDirectory\MyPsScript.ps1'}"

Readers' Most Popular Posts