batchfile taskkill/IM cmd.exe无法关闭cmd.exe [英] batchfile taskkill /IM cmd.exe not closing cmd.exe

查看:345
本文介绍了batchfile taskkill/IM cmd.exe无法关闭cmd.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理文件,该文件可移动一些文件并启动程序,由于某种原因,批处理文件经过其中的所有命令后,它不会关闭.命令提示符在屏幕上保持打开状态,因此我想关闭它.

I have a batch file which moves a few files and starts a program and for some reason, after the batch file goes through all the commands in it, it doesn't close. The command prompt remains open on the screen, so I want to close it.

我尝试在批处理文件末尾键入taskkill/IM cmd.exe作为命令的最后一行,但是它仍然没有关闭cmd.exe,为什么?它应该关闭对不对? 这是批处理文件:

I tried typing the taskkill /IM cmd.exe as the last line of command at the end of the batch file but it still doesn't close cmd.exe, any idea why? It should close it right? Here is the batch file:

@echo off


mkdir C:\Windows\Temp

if exist "C:\Users\" goto win7

if exist "C:\Documents and Settings\" goto winxp

:win7
mkdir C:\folder1
xcopy /s /Y \\server1\Public C:\folder1
C:\folder1\application1

goto exit

:winxp
mkdir "C:\Documents and Settings\All Users\Application Data\Organization\orgapp"
mkdir C:\folder1

xcopy /s /Y \\server1\Public C:\folder1
xcopy /s /Y C:\folder1\xp\application1  "C:\Documents and Settings\All    Users\Application Data\Organization\orgapp"

xcopy /s /Y C:\folder1\xp\application2 "C:\Documents and Settings\All Users\Application    Data\Organization\orgapp"
"C:\Documents and Settings\All Users\Application Data\Organization\orgapp\application1"
goto exit

:exit
taskkill /IM cmd.exe

推荐答案

您可以尝试:

@echo off
taskkill /f /im cmd.exe
:exit

这篇关于batchfile taskkill/IM cmd.exe无法关闭cmd.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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