且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

新实例中的 PowerShell 启动脚本

更新时间:2022-05-18 23:21:05

要在外部 PS 窗口中启动,您可以使用以下命令:

To launch in an external PS window, you can use the following:

invoke-expression 'cmd /c start powershell -Command { [script block here] }'

例如:

invoke-expression 'cmd /c start powershell -Command { write-host "Hi, new window!"; set-location "C:\"; get-childitem ; sleep 3}'