在Windows bat脚本中禁用“暂停” [英] Disable 'pause' in windows bat script

查看:477
本文介绍了在Windows bat脚本中禁用“暂停”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows中,我正在运行一个bat脚本,该脚本当前以暂停结尾,并提示用户按任意键继续...

In windows, I am running a bat script that currently ends with a 'pause' and prompts for the user to 'Press any key to continue...'

在这种情况下,我无法编辑文件,我需要脚本终止而不是挂起,等待永远不会出现的输入。我有办法运行这种方法来禁用或避开提示吗?

I am unable to edit the file in this scenario and I need the script to terminate instead of hang waiting for input that will never come. Is there a way I can run this that will disable or circumvent the prompt?

我尝试在输入中进行管道传输,但似乎无济于事。

I have tried piping in input and it does not seem to help. This script is being run from python via subprocess.Popen.

推荐答案

尝试执行 cmd.exe / c YourCmdFile< nul

YourCmdFile -批处理脚本的完整路径

YourCmdFile - full path to your batch script

这篇关于在Windows bat脚本中禁用“暂停”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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