启动/等待命令出现问题

发布于 2024-11-24 20:16:44 字数 427 浏览 5 评论 0原文

            @echo off
            start /wait notepad
            start worpad

这是我在批处理文件中编写的代码。我的目标是停止批处理文件执行,直到记事本应用程序关闭。它工作完美,但问题是,它还显示命令提示符。当我执行时,它打开命令提示符。

     start /wait notepad in my batch file. 

当我关闭记事本时,命令提示符会关闭。但我不想要命令提示符。我该怎么做。 我什至尝试了这些

    cmd /c start /wait notepad

即使上面的命令不起作用, 。我该怎么做。如何在没有命令提示符的情况下只打开记事本并等待它关闭?

            @echo off
            start /wait notepad
            start worpad

This is the code i have written in a batch file. My aim is to stop the batch file execution till the notepad application gets closed. Its working perfect but the thing is, Its displaying the command prompt also .Its opening the command prompt when i execute

     start /wait notepad in my batch file. 

The command prompt gets closed when i close my notepad. But i dont want the command prompt.How do i make that. I even tried these

    cmd /c start /wait notepad

even the above command is not working. How do i make it.How do i open only notepad without the command prompt and wait till it is closed ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧人 2024-12-01 20:16:44

正如我在回答一个在您之前的问题中,命令提示符窗口之所以存在,是因为它是处理批处理文件的工具。命令提示符窗口是CMD.EXE程序的工作窗口,就像记事本的工作窗口是您编辑文本文件的窗口一样。通常,在隐藏工作窗口的情况下运行程序是一项艰巨的任务,除非程序具有使用隐藏窗口运行的预定义模式。碰巧的是,CMD 确实没有有这样的模式。

然而,有一种方法可以在窗口最小化的情况下启动程序。您只需创建程序的快捷方式(也可以是批处理文件),然后打开快捷方式的属性,并在“快捷方式”选项卡上将“运行”属性设置为“最小化”。为了更清楚地说明,这里有一个插图:

在此处输入图像描述

As I said in my answer to one of your previous questions, the command prompt window is there because it is the tool that processes the batch file. The command prompt window is the working window of the CMD.EXE program, just like Notepad's working window is the one where you are editing text files. Typically, running a program with its working window hidden is a non-trivial task, unless the program has a pre-defined mode of running with the hidden window. As it happens, CMD does not have such a mode.

However, there is a way of starting a program with its window minimised. You only need to create a shortcut to your program (it can be a batch file too), then open the shortcut's properties, and on the Shortcut tab, set the Run property to Minimized. To make it clearer, here's an illustration:

enter image description here

彼岸花似海 2024-12-01 20:16:44

或者也许你可以只使用

ping localhost -n ( your time in second ) >nul

所以你的代码将像这样

@echo off

start notepad

ping localhost -n ( your time in second ) >nul

start worpad

Or maybe you can just use the

ping localhost -n ( your time in second ) >nul

So your code will be like this

@echo off

start notepad

ping localhost -n ( your time in second ) >nul

start worpad

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文