title: batchfile taskkill /IM cmd.exe not closing cmd.exe
body: <p>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. </p>
  
  <p>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:</p>
  
  <pre><code>@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
  </code></pre>