99

I am writing a script to use multiple plink (PuTTY) sessions as a Windows version of clusterssh. I am stuck however because I want to open multiple Powershell windows from powershell. When I type the command for powershell, it opens a new session. This is similar to typing bash in bash. I want multiple physical windows opening.

I tried -windowstyle as well as the other args to no avail. I was wondering if there is a way you know of. I really appreciate your help. I looked and didn't find anything already here. Thanks for your time.

6 Answers 6

209

This will open a new window.

Either:

start-process powershell

Or:

start powershell
Sign up to request clarification or add additional context in comments.

6 Comments

Even simpler is start powershell
Both of these commands preserve CWD of the old terminal! Good to know!
Possible to set the start directory via -WorkingDirectory directly.
saps powershell is even shorter to type
Odd thing - I'd changed the Powershell background colour a long time ago (well before opening the first Powershell window today!). When I opened a new window with this command, it had the original default colour.
|
37

if you are trying to open a new window and launch a new script:

start powershell {.\scriptInNewPSWindow.ps1}

1 Comment

Works great when you need to kick off a series of processes (i.e. npm). There might be a better way, but as a developer that needs to get working quickly, this is great!
27

This will do it:

Invoke-Item C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

2 Comments

This sets the CWD of the new process to C:\WINDOWS\system32 at least it does on my machine.
If anyone reads this, check out the answer with more up-votes at the bottom (here)
5

To start Powershell 6 from a PS console start pwsh might do the trick.
It starts in the same folder.

(I haven't delved into it but I guess PS6's pwsh.exe has to be in the path for it to work.)

Comments

4

This works for me:

$argList = "-file `"$Location\script.ps1`"" Start-Process powershell -argumentlist $argList

(The backticks are necessary. This can be copied outright.) Variables can be used in the "-file" parameter (such as one set at the beginning of the script to reflect the location of the file) and spaces can appear in the variable due to the backticks.

Edited to use a two-line solution (the "$argList" variable) because PowerShell can mangle things otherwise.

Comments

1

If you prefer using Windows Terminal rather than the native PowerShell terminal, you can use this instead:

start-process wt

If you need to run with admin privilege, use:

start-process wt -verb runas

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.