如何使Powershell运行批处理文件然后保持打开状态? [英] How do I make Powershell run a batch file and then stay open?

查看:58
本文介绍了如何使Powershell运行批处理文件然后保持打开状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如;使用旧的命令提示符将是:

For example; with the old command prompt it would be:

cmd.exe /k mybatchfile.bat

推荐答案

拖放到cmd实例(或者实际上是PowerShell本身)中,然后键入以下内容:

Drop into a cmd instance (or indeed PowerShell itself) and type this:

powershell -?

您会看到powershell.exe具有一个"-noexit"参数,该参数告诉它执行启动命令"后不要退出.

You'll see that powershell.exe has a "-noexit" parameter which tells it not to exit after executing a "startup command".

这篇关于如何使Powershell运行批处理文件然后保持打开状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆