如何在不退出控制台的情况下从.bat在新窗口中启动PowerShell并运行.ps1? [英] How to start PowerShell in a new window from .bat and run a .ps1 without exiting the console?
本文介绍了如何在不退出控制台的情况下从.bat在新窗口中启动PowerShell并运行.ps1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个.bat文件
I would like to have a .bat file that
- 在新窗口中打开PowerShell控制台
- 并运行.ps1脚本
- 并且不会退出并关闭PowerShell控制台.
我的批处理文件包含以下行:
My batch file contains the following line:
start powershell.exe -Command "&'D:\MyToolkit\ToolKit.ps1'"
但是,它会在运行脚本后关闭PowerShell.
However, it closes the PowerShell after running the script.
有什么建议吗? 谢谢
推荐答案
start powershell -noexit -file "D:\MyToolkit\ToolKit.ps1"
也是
根据需要将-Command
更改为-File
这篇关于如何在不退出控制台的情况下从.bat在新窗口中启动PowerShell并运行.ps1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文