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


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'}"

About Me

My photo
Tod Gentille (@todgentille) is now a Curriculum Director for Pluralsight. He's been programming professionally since well before you were born and was a software consultant for most of his career. He's also a father, husband, drummer, and windsurfer. He wants to be a guitar player but he just hasn't got the chops for it.