如何从Powershell打开Powershell控制台窗口

msm*_*886 62 powershell powershell-2.0

我正在编写一个脚本,使用多个plink(PuTTY)会话作为clustersh的Windows版本.我被困了,因为我想从powershell打开多个Powershell窗口.当我为powershell键入命令时,它会打开一个新会话.这类似于在bash中键入bash.我想打开多个物理窗口.

我试过-windowstyle以及其他args无济于事.我想知道你是否有办法知道.我非常感谢你的帮助.我看了,在这里找不到任何东西.谢谢你的时间.

And*_*ndi 134

这将打开一个新窗口.

或者:

start-process powershell
Run Code Online (Sandbox Code Playgroud)

要么:

start powershell
Run Code Online (Sandbox Code Playgroud)

  • 更简单的是`start powershell` (33认同)
  • 这两个命令都保留了旧终端的CWD!很高兴知道! (7认同)
  • 可以直接通过 `-WorkingDirectory` 设置起始目录。 (2认同)
  • `saps powershell` 输入更短 (2认同)

EBG*_*een 18

这样做:

Invoke-Item C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Run Code Online (Sandbox Code Playgroud)

  • 我几乎扭伤了我的手指输入...我想念旧的DOS启动命令 (2认同)
  • 如果有人读过此书,请在底部以更多赞成票来检查答案([此处](/sf/answers/1096827581/)) (2认同)

jef*_*i13 16

如果您尝试打开新窗口并启动新脚本:

start powershell {.\scriptInNewPSWindow.ps1}
Run Code Online (Sandbox Code Playgroud)