Ability to close the DOS window of a batch file

Solved
Joël SERRA -  
 lfg -
Hello,

Under Windows XP, when launching an executable in a ".cmd" or ".bat",
I want to close the DOS window as soon as my "exe" is launched...

I can't find the syntax to do that.. who can help?
Thank you

Joël
Configuration: Windows XP Internet Explorer 6.0

14 answers

  1. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    Bonjour

    début <commande>
    sortie
    30
    1. aflame
       
      Thank you soooo much!!
      0
    2. lfg
       
      some words from 2007 still useful in 2019 :o)
      1
  2. Joël SERRA
     
    No, the command "exit" is only taken into account after the executable launched in the batch is closed, whereas my need is for "exit" to be taken into account as soon as the executable is launched!

    I looked at TASKKILL, but it doesn't seem to work either because "TASKKILL /im cmd.exe" closes all open DOS windows. Is there a syntax that allows me to "kill" only the one that interests me?
    7
  3. gillesv
     
    Hello
    I created a shortcut for two programs and a cmd window that closes

    cd /d I:\FirefoxPortable <------- location of the programs
    start U96 <------- first program
    start FirefoxPortable <------- second program
    exit
    7
    1. Paul0693 Posted messages 19 Status Member 3
       
      I used the same thing and it seems good and compact to me.
      0
  4. Mohamed
     
    Thanks Dubcek, your trick with start and exit worked...
    Cool
    1
  5. Mrtuil
     


    @echo off

    At the beginning of the .bat file
    This way, the DOS window doesn't even open.
    1
    1. Frouch3
       
      False, nothing is written in it! It still opens!
      0
  6. RiDDicK
     
    Hi

    I have the same problem, I run an executable from a .bat file but the DOS window stays open.
    I tried what’s above but it doesn’t work, or maybe I typed my command line wrong. Could you please write the command line for me with the correct syntax just right? It's important, it's for a project!!!
    Thanks in advance!!!
    0
  7. elmou1930
     
    Hello

    my batch file window does not close automatically (in DOS)
    0
  8. samy823
     
    Hello

    For my part, it works very well, thank you for this very valuable help!

    For those for whom it doesn't work, here is the content of my *.bat file, if it can help you:

    cd /d c:\hlserver
    start hlds -console -game cstrike +port 27015 -nomaster -insecure +servercfgfile server.cfg
    exit
    0
  9. saysay
     
    You need to put "pause" in your bat file
    Ex: CNEXT.exe -d "path"
    pause

    This will leave your command window open after running your .exe
    0
    1. seb
       
      I have the phrase "Press any key to continue..." which prevents DOS from closing... sniff... what should I do please?
      0
    2. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
       
      remove pause
      0
  10. seb
     
    I have the sentence "Press any key to continue..." that prevents DOS from closing... sniff... what to do?
    0
  11. selrak Posted messages 16 Status Member
     
    Hello

    To remove the message:

    " press any key to continue "

    you need to write:
    " pause >nul "

    at the end of each command that displays a message in the prompt, if you want to delete them, you need to add " >nul " after the command

    IMPORTANT: you need to include a space, e.g.:
    choice /c:ab >nul
    0