用于打开新 PowerShell window 和 运行 命令的 PowerShell 脚本

PowerShell script to open a new PowerShell window and run command

我正在寻找一种方法来编写能够打开新的 PowerShell window 和 运行 命令的脚本。例如。我想启动 PowerShell,在此 window 我需要 运行 一个能够打开新的 PowerShell window 的脚本,在其中执行命令 pwd。

试试这个命令

Start-Process powershell.exe -ArgumentList "-noexit"  



 Start-Process powershell -ArgumentList "-noexit", "-noprofile", "-command &{Get-Location}"

开始 Window 最大化参数 -WindowStyle Maximized

提供更多代码以获取更多信息