Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed problem with Invoke-Expression #667

Merged
merged 2 commits into from
Oct 15, 2015
Merged

Fixed problem with Invoke-Expression #667

merged 2 commits into from
Oct 15, 2015

Conversation

Pireax
Copy link
Contributor

@Pireax Pireax commented Oct 15, 2015

Invoke-Expression has a problem with spaces in path names(oops), this fixes that issue.
Also, the file or atleast the lambda needs to be encoded in UTF-8-BOM else it won't show properly.

@@ -74,7 +74,7 @@ $env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config/user-profile.ps1"
if(Test-Path $CmderUserProfilePath) {
# Create this file and place your own command in there.
Invoke-Expression $CmderUserProfilePath
& $CmderUserProfilePath
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's to just run the profile.ps1 into the current session you want to dot source it:

. "$CmderUserProfilePath"

Honestly I'm not sure what & will do different but you'll see a lot of 'dot source' when looking at powershell examples so it would be more consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked it up, the difference between dot sourcing and the ampersand is that dot sourcing gives the command prompt access to the variables and functions defined in the script after execution, with an ampersand you can't access them from the command prompt.

Stanzilla added a commit that referenced this pull request Oct 15, 2015
Fixed problem with Invoke-Expression
@Stanzilla Stanzilla merged commit 80bafd1 into cmderdev:development Oct 15, 2015
@Stanzilla
Copy link
Member

AH so that was what @Jackbennett removed here 7ebfffc :D

@Pireax Pireax deleted the posh-user-script-fix branch October 16, 2015 06:32
@Jackbennett
Copy link
Contributor

I wasn't sure what it was but powershell wouldn't run with it so out it came :)

How'd that get in there I thought git would deal with all that. Are you writing PS in something that isn't the ISE? That complained about the character immediately. (Not using the ISE is perfectly fine by the way)

@MartiUK
Copy link
Member

MartiUK commented Oct 16, 2015

A Microsoft made application, that doesn't support UTF-8? Colour me surprised. 😆

@Jackbennett
Copy link
Contributor

I have out aliased to out-file -encoding UTF8 haha. Don't start me on excel and csv's.

@Stanzilla
Copy link
Member

I actually use GitHub's Atom editor for almost anything

@Jackbennett
Copy link
Contributor

Ever given brackets ago @Stanzilla ?

I only ask because I made the jump from sublime to brackets. Atom came out about a year later and I just haven't considered switching.

Only downside with not using the ISE is you're missing that sweet sweet intellisense

@Stanzilla
Copy link
Member

I always wanted to but was too lazy to switch from Sublime, now Atom has most of the features I wanted to try Brackets for as plugins...Atom is still pretty new but community and devs are great and pushing really hard to get stuff done and I love that, so I'm stuck there for now :D

@MartiUK
Copy link
Member

MartiUK commented Oct 16, 2015

I did those last few commits to martiuk-dev with vim... on my phone. Is that too far?

I usually use vim on Linux or sublime text 3 on Qindows.

@DanielGGordon
Copy link

Vim on your phone? Lol that's hardcore dude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants