Batch file window closing
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Batch file window closing

  1. #1
    Join Date
    Mar 2011
    Posts
    153

    Batch file window closing

    Hi I hope this is the right place to post this. I a batch file that makes navigating so much easier. It's a dos window so the UI isn't exactly friendly. When you look at it and try it out for yourself, you'll see that you can select a website without the window closing but when you select and application (provided you have ccleaner, change it to something else if you don't.) the window closes. How can I keep it from closing. Please test any solution you may have. Here is the code


    Code:
    @echo off
    color 70
    title Selector by Matt Chatterton
    
    
    :MainMenu
    echo ***************************************************************
    echo.
    echo Selector main menu
    echo.
    echo ***************************************************************
    echo.
    echo [1] Site Selector
    echo [2] Application Selector
    echo [3] Music Selector
    
    
    set /p udefine= 
    if %udefine%==1 goto sites
    if %udefine%==2 goto apps
    if %udefine%==3 goto music
    
    
    :sites
    echo ***************************************************************
    echo.
    echo Site Selector
    echo.
    echo ***************************************************************
    echo.
    echo [1] Google - Search Engine
    echo [2] YouTube - Online Videos
    echo [3] The Pirate Bay - Torrents
    echo [4] Mail.com - eMail
    echo.
    echo [e] Exit
    echo [mm] Main Menu
    echo.
    echo ***************************************************************
    echo Enter the number of the website which you would like to go to:
    echo.
    set /p udefine= 
    echo.
    echo ***************************************************************
    if %udefine%==1 start www.google.com
    if %udefine%==2 start www.youtube.com
    if %udefine%==3 start www.thepirat****.org
    if %udefine%==4 start www.mail.com
    if %udefine%==e goto exit
    if %udefine%==mm goto MainMenu
    goto sites
    
    
    :apps
    echo ***************************************************************
    echo.
    echo Application Selector
    echo.
    echo ***************************************************************
    echo.
    echo [1] CCleaner
    echo [2] Rosetta Stone
    echo [3] 
    echo.
    echo [e] Exit
    echo.
    echo ***************************************************************
    echo Enter the number of the website which you would like to go to:
    echo.
    set /p udefine= 
    echo.
    echo ***************************************************************
    if %udefine%==1 start ccleaner.exe
    if &udefine%==2 start
    if &udefine%==3 start
    if %udefine%==e goto exit
    if %udefine%==mm goto MainMenu
    goto apps
    
    :music
    echo ***************************************************************
    echo.
    echo Music Selector
    echo.
    echo ***************************************************************
    echo.
    echo [1] Avenged Sevenfold - Nightmare
    echo [2] Avenged Sevenfold - Scream
    echo [3] Five.Bolt.Main-Bid - Farewell
    echo [4] Jen Titus - O Death
    echo [5] Pantera - Cowboys From Hell
    echo.
    echo [e] Exit
    echo.
    echo ***************************************************************
    echo Enter the number of the website which you would like to go to:
    echo.
    set /p udefine= 
    echo.
    echo ***************************************************************
    if %udefine%==1 start O:\Music\Avenged_Sevenfold-Nightmare.mp3
    if &udefine%==2 start O:\Music\Avenged_Sevenfold-Scream.mp3
    if &udefine%==3 start O:\Music\Five.Bolt.Main-Bid_Farewell.mp3
    if &udefine%==4 start O:\Music\Jen_Titus-O_Death.mp3
    if &udefine%==5 start O:\Music\Pantera-Cowboys_From_Hell.mp3
    if %udefine%==e goto exit
    if %udefine%==mm goto MainMenu
    goto music
    
    stop
    Ps some programs won't open like MalwareBytes.

    I've used

    start mbam.exe
    start "" "[target path]\mbam.exe"

    and a few other approaches. Perhaps some programs require another command.

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,840

    Re: Batch file window closing

    [ moved thread ]
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center