批处理文件:如何离开控制台窗口打开 [英] Batch files : How to leave the console window open

查看:420
本文介绍了批处理文件:如何离开控制台窗口打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个批处理文件,其中一人执行另一个,即


  1. 我的批处理文件> 2。其他一些批处理文件

我创建了一个批处理文件的快捷方式和编辑它的属性来调用其方法如下:

 的cmd.exe / K< SomePath> \\<我的批处理文件>蝙蝠&放大器;暂停

我想做的事情什么
我希望控制台窗口打开后,该批处理文件执行结束。现在,它只是关闭,试图围绕CMD标志玩,没有任何结果。

平台:Windows7的


更新1

修改结构,像这样简单的例子不工作为好,
只有一个批处理文件,即不存在的2。一些其他批处理文件
唯一的批处理文件包含水木清华这样的

 启动/ B / LOW / WAIT使包
CMD / K


更新2

这是从资源管理器中调用不会关闭控制台窗口相同的快捷方式。
但是,控制台窗口关闭时,该快捷方式从固定项目上调用任务栏

任何想法如何保持控制台窗口打开?


解决方案

如果这是真的所有的批处理文件是干什么的,删除 CMD / K 并添加暂停

 启动/ B / LOW / WAIT使包
暂停

然后,只需将您的快捷方式我的批处理File.bat ...没必要用运行CMD / K

更新

嗯,一些新的信息...你试图从任务栏上的快捷方式寄托做到这一点。

我发现这一点,<一个href=\"http://social.technet.microsoft.com/Forums/en-US/w7itproui/thread/a44e74a1-20cd-4924-8f2b-3e6b688f1ad7\">Adding批处理文件到Windows 7任务栏像Vista中/ XP快速启动,与下面的相关部分。


  

      
  1. 首先,引脚 CMD.EXE 到任务栏的快捷方式,使用SoonerSkeene告诉我们上面的方法。

  2.   
  3. 右键单击任务栏上的快捷方式。

  4.   
  5. 您将看到包括列表的命令提示符的和从任务栏取消固定此程序的。

  6.   
  7. 右键单击 CMD.EXE 图标,然后选择属性

  8.   
  9. 在目标框,转到年底的%SystemRoot%\\ SYSTEM32 \\ cmd.exe的键,键入/ C 和路径和名称
      该批处理文件。

  10.   

你的目的,你可以:


  1. 使用 / C ,把一个暂停在您的批处理文件的结尾。


  2. 更改命令行中使用 / K 并从批处理文件删除暂停

I have two batch files, one of them executes another, i.e.

  1. "My Batch File" > 2. "Some Other Batch File"

I've created a shortcut of the first batch file and edited its properties to call its in following way.

cmd.exe /k "<SomePath>\<My Batch File>.bat" & pause

What i want to do I want the console window to be open after the execution of the batch file is over. Now it just closes, tried to play around the cmd flags, no result.

Platform : Windows7


UPDATE 1

Modified the structure, the simple example like this does not work as well, Only one batch file i.e. there is no the 2. "Some Other Batch File" The only batch file contains smth like this

start /B /LOW /WAIT make package
cmd /K


UPDATE 2

The same shortcut which is invoked from Explorer does not close the console window. But the console window closes when the shortcut is invoked from the pinned item on taskbar

Any ideas how to keep the console window open?

解决方案

If that is really all the batch file is doing, remove the cmd /K and add PAUSE.

start /B /LOW /WAIT make package
PAUSE

Then, just point your shortcut to "My Batch File.bat"...no need to run it with CMD /K.

UPDATE

Ah, some new info...you're trying to do it from a pinned shortcut on the taskbar.

I found this, Adding Batch Files to Windows 7 Taskbar like the Vista/XP Quick Launch, with the relevant part below.

  1. First, pin a shortcut for CMD.EXE to the taskbar, using the method SoonerSkeene told us about above.
  2. Right-click the shortcut on the taskbar.
  3. You will see a list that includes "Command Prompt" and "Unpin this program from the taskbar".
  4. Right-click the icon for CMD.EXE and select Properties.
  5. In the box for Target, go to the end of "%SystemRoot%\system32\cmd.exe" and type " /C " and the path and name of the batch file.

For your purposes, you can either:

  1. Use /C and put a PAUSE at the end of your batch file.

    OR

  2. Change the command line to use /K and remove the PAUSE from your batch file.

这篇关于批处理文件:如何离开控制台窗口打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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