tugberk
tugberk

Reputation: 58444

Resetting the session in PowerShell

When I change a setting in my PowerShell profile, I am closing the PowerShell window and reopening it to reset the session.

I assume there is a better command or cmdlet to refresh the session. Any clue?

Upvotes: 12

Views: 14322

Answers (2)

JPBlanc
JPBlanc

Reputation: 72630

You can just dotsource your profile.

. $Profile

If your profile handles errors when things like drives, or vars even exists, everything is ok.

Upvotes: 5

Shay Levy
Shay Levy

Reputation: 126732

You can try and dot-source your profile instead though some things may not work (like trying to redefine constants, etc).

A blog post to restart the shell:

http://scriptolog.blogspot.com/2006/12/restart-your-engins-powershell-way_28.html

Upvotes: 0

Related Questions