暂停在批处理文件不工作 [英] pause in batch file not working

查看:137
本文介绍了暂停在批处理文件不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个测试,看看文件是否存在一个批处理文件。
在这之后,它必须暂停。

I have a batch file that tests to see if a file exists. After that, it has to pause.

但暂停工作不因某种原因。结果
任何帮助,请。谢谢了

But pause is not working for some reason.
Any help please. thanks much

  if exist C:\autoexec.bat 
  ECHO Folder C:\autoexec.bat exists
  PAUSE


暂停工作在命令提示符下。


Pause works at command prompt.

文件存在是肯定的。但我看不到回音,以及暂停
屏幕上消失,只是当我运行.bat文件

The file exists for sure. But I can't see Echo as well as Pause The screen just disappears once I run the .bat file

推荐答案

你要这样写:

if exist C:\autoexec.bat ECHO Folder C:\autoexec.bat exists
PAUSE

请注意后,壳牌指令是否期待一个要执行的命令。如果没有条件去后没有命令就应该中止批次:
该命令的语法不正确。

Note that shell after the if command is expecting a command to execute. If there is no command after de condition it should abort batch with: "The syntax of the command is incorrect."

编辑。 Mr.Helpy得到它第一次。

Edit. Mr.Helpy Got it first.

请注意,如果你想多行使用块

Note if you want multiple lines use a block

if exist C:\autoexec.bat (
ECHO Folder C:\autoexec.bat exists
REM other commands...
)
PAUSE

这篇关于暂停在批处理文件不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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