3

Is it possible to duplicate a powershell session in a new window? I often find that I've created environment variables, activated a specific python virtualenvironment, defined one-off functions, custom prompt, etc. and it would be handy to duplicate those specific, one-off details of the current session into another session in another window.

2 Answers 2

1

You should use Powershell profile. In the profile you can have all of those functions, variables etc. Basically every time you open a powershell window, you can load your custom powershell profile which in turn will also load your settings as defined. Please see this link: Powershell profile.

1
  • 4
    That totally does not answer the question as asked : "it would be handy to duplicate those specific, one-off details of the current session into another session". Profiles are for things you will always want set; this is a different scenario. Commented Oct 7, 2014 at 16:36
0

There's nothing I'm aware of, out of the box, that will do this. You could write a script to dump all of the things you care about, and then paste those into your new window.

get-childitem -path env: 

will show all your environment variables.

Get-Variable 

will show your powershell variables.

Get-ChildItem -path function: 

will show all functions. If you have a naming convention for your custom ones, you could filter on just those.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.