我编写的批处理文件不会自动关闭或退出时关闭

发布于 2024-07-29 03:48:07 字数 465 浏览 3 评论 0原文

我在启动蠕虫之前制作了这个批处理文件来关闭资源管理器,因为由于某种原因,如果我不这样做,我的颜色就会变得混乱。 批处理文件工作正常,只是完成后它不会关闭。 我做错了什么?

@echo off
echo Closing explorer and launching worms
taskkill /F /IM explorer.exe
"C:\Games\Worms Armageddon - New Edition\wa"
echo Hit any key to resume explorer!
pause
"C:\windows\explorer"
exit

我尝试使用 start 来调用程序,当我使用

start "C:\windows\explorer"

它时,只会打开一个新的命令窗口,标题栏显示 explorer.exe,但我的任务栏和所有内容仍然消失。

I made this batch file to close explorer before launching Worms because for some reason my colors get messed up if I don't. The batch file works fine except that it doesn't close when it's finished. What did I do wrong?

@echo off
echo Closing explorer and launching worms
taskkill /F /IM explorer.exe
"C:\Games\Worms Armageddon - New Edition\wa"
echo Hit any key to resume explorer!
pause
"C:\windows\explorer"
exit

I've tried using start to call the programs and when I use

start "C:\windows\explorer"

it just opens a new command window and the titlebar says explorer.exe but my taskbar and everything is still gone.

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

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

发布评论

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

评论(1

守不住的情 2024-08-05 03:48:07

START 很挑剔。 根据帮助:

C:\>start /?
Starts a separate window to run a specified program or command.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/WAIT] [/B] [command/program]
      [parameters]

    "title"     Title to display in  window title bar.
    ...

正如您在此处看到的,第一个参数可以是标题。 似乎引号在这里具有某种含义,可以作为标题,但并非总是如此。

无论如何,请尝试以下操作:

start "dummy" "explorer.exe"

注意,您可以通过指定 explorer.exe 的完整路径来避免这种情况,如下所示:(

start c:\windows\explorer.exe

注意缺少的引号,将引号放回去,它又是一个标题)。

正如我所说,挑剔。

START is finicky. As per the help:

C:\>start /?
Starts a separate window to run a specified program or command.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/WAIT] [/B] [command/program]
      [parameters]

    "title"     Title to display in  window title bar.
    ...

As you can see here, the first argument could be a title. It seems that the quotes have a meaning here that could be a title, but not always.

Anyway, instead, try this:

start "dummy" "explorer.exe"

Note, you can avoid this by specifying the full path to explorer.exe, like this:

start c:\windows\explorer.exe

(note the missing quotes, put the quotes back, and it's a title again).

As I said, finicky.

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