1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

What's wrong with this batch code.

Discussion in 'Programming & Webmastering' started by SuddenG, May 6, 2009.

  1. SuddenG New Member

    Joined:
    May 6, 2009
    Messages:
    7 (0.00/day)
    Thanks Received:
    0
    Hi, I've been developing this program and I always get this problem:

    When I type option c it works fine, also option m works fine. But when I type option f it takes me to option c. I've re-written it and it still happens.

    Please your suggestions and help will be appreciated:

    Code:
    @echo off
    title C:SS help program.
    :menu
    color e
    echo   **************************************************************
    echo   C:SS Help Program - Built by SuddenGunfire
    echo   **************************************************************
    echo.
    echo Please choose an option below to start!
    echo.
    echo ********************************************************
    echo C = Find your Counter-Strike:Source Folder.
    echo M = Install C:SS maps.
    echo F = Goto counterstrikesource.com C:SS help section.
    echo P = Find your system Specs.
    echo G = Install Skins.
    echo O = Copyright information.
    echo E = Exit the program.
    echo *******************************************************
    echo.
    set /p c=Option:
    if %c%==c goto c
    if %c%==C goto c
    if %c%==m goto m
    if%c%==M goto m
    if%c%==f goto f
    if%c%==F goto s
    if%c%==p goto p
    if%c%==P goto p
    if%c%==g goto g
    if%c%==G goto g
    if%c%==o goto o
    if%c%==O goto o
    if%c%==e goto e
    if%c%==E goto e
    :c
    cls
    echo.
    echo ----------------------------------------------------------------------------------------------------------
    echo This will open the SteamApps folder.
    echo Once there you need to click on the folder with your Steam account name on.
    echo.
    echo Press any key to open your C:SS folder.
    echo ----------------------------------------------------------------------------------------------------------
    pause>nul
    %SystemRoot%\explorer.exe "C:\Program Files\Steam\Steamapps"
    pause>nul
    cls
    goto :menu
    :m
    cls
    echo.
    echo -----------------------------------------------------------------------------------------------------------------------------------------------
    echo This section will take you to a popular skin website and will also open your materials and models folder.
    echo -----------------------------------------------------------------------------------------------------------------------------------------------
    echo.
    echo Please press any key to start installing maps...
    pause>nul
    start explorer http://www.fpsbanana.com/skins/games/2
    %SystemRoot%\explorer.exe "C:\Program Files\Steam\Steamapps\"
    cls
    echo When steamapps is loaded up navigate to:
    echo yourname-cstrike-
    echo Then drag and drop your skin files into there.
    echo.
    echo If prompted to overwrite files, click "Yes To All" 
    pause>nul
    cls
    goto :menu
    :f
    cls
    echo.
    echo -----------------------------------------------------------------------------------------------------------------------------
    echo This section will take you to the counterstrikesource.com C:SS support section.
    echo -----------------------------------------------------------------------------------------------------------------------------
    start explorer http://www.counterstrikesource.com/forums/viewforum.php?f=38
    cls
    echo Thank you for visiting, you should register it's great.
    echo.
    echo I'm a member there, look up "SuddenGunfire"
    pause>nul
    cls
    goto :menu
    
    
     
  2. Kreij

    Kreij Senior Monkey Moderator Staff Member

    Joined:
    Feb 6, 2007
    Messages:
    13,881 (4.53/day)
    Thanks Received:
    5,624
    Location:
    Cheeseland (Wisconsin, USA)
    Well, if you are typing an uppercase "F" it's telling you to go to "s".
     
  3. SuddenG New Member

    Joined:
    May 6, 2009
    Messages:
    7 (0.00/day)
    Thanks Received:
    0
    I changed that but it still didn't help.
     
  4. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    15,080 (6.15/day)
    Thanks Received:
    4,706
    Location:
    IA, USA
    Put a space in "Go to" or replace goto with "Open" or something similar. That might fix it.


    May I also suggest that you use more descriptive labels? For instance, instead of "c" use "folder." You could easily be getting overlap of names causing erratic behavior.
     
    Crunching for Team TPU
  5. SuddenG New Member

    Joined:
    May 6, 2009
    Messages:
    7 (0.00/day)
    Thanks Received:
    0
    This isn't helping.!
     
  6. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    15,080 (6.15/day)
    Thanks Received:
    4,706
    Location:
    IA, USA
    Well, if that is the whole batch then you're missing several of them.

    p, g, o, and e labels are missing. If you push a key that references a non-existant label, the goto just falls through.

    I renamed the labels that are present below.
    Code:
    @echo off
    title C:SS help program.
    :menu
    color e
    echo   **************************************************************
    echo   C:SS Help Program - Built by SuddenGunfire
    echo   **************************************************************
    echo.
    echo Please choose an option below to start!
    echo.
    echo ********************************************************
    echo C = Find your Counter-Strike:Source Folder.
    echo M = Install C:SS maps.
    echo F = Open counterstrikesource.com C:SS help section.
    echo P = Find your system Specs.
    echo G = Install Skins.
    echo O = Copyright information.
    echo E = Exit the program.
    echo *******************************************************
    echo.
    set /p opt=Option:
    if %opt%==c goto folder
    if %opt%==C goto folder
    if %opt%==m goto maps
    if %opt%==M goto maps
    if %opt%==f goto help
    if %opt%==F goto help
    if %opt%==p goto p
    if %opt%==P goto p
    if %opt%==g goto g
    if %opt%==G goto g
    if %opt%==o goto o
    if %opt%==O goto o
    if %opt%==e goto e
    if %opt%==E goto e
    
    :folder
    cls
    echo.
    echo ----------------------------------------------------------------------------------------------------------
    echo This will open the SteamApps folder.
    echo Once there you need to click on the folder with your Steam account name on.
    echo.
    echo Press any key to open your C:SS folder.
    echo ----------------------------------------------------------------------------------------------------------
    pause>nul
    %SystemRoot%\explorer.exe "C:\Program Files\Steam\Steamapps"
    pause>nul
    cls
    goto :menu
    
    :maps
    cls
    echo.
    echo -----------------------------------------------------------------------------------------------------------------------------------------------
    echo This section will take you to a popular skin website and will also open your materials and models folder.
    echo -----------------------------------------------------------------------------------------------------------------------------------------------
    echo.
    echo Please press any key to start installing maps...
    pause>nul
    start explorer http://www.fpsbanana.com/skins/games/2
    %SystemRoot%\explorer.exe "C:\Program Files\Steam\Steamapps\"
    cls
    echo When steamapps is loaded up navigate to:
    echo yourname-cstrike-
    echo Then drag and drop your skin files into there.
    echo.
    echo If prompted to overwrite files, click "Yes To All" 
    pause>nul
    cls
    goto :menu
    
    :help
    cls
    echo.
    echo -----------------------------------------------------------------------------------------------------------------------------
    echo This section will take you to the counterstrikesource.com C:SS support section.
    echo -----------------------------------------------------------------------------------------------------------------------------
    start explorer http://www.counterstrikesource.com/forums/viewforum.php?f=38
    cls
    echo Thank you for visiting, you should register it's great.
    echo.
    echo I'm a member there, look up "SuddenGunfire"
    pause>nul
    cls
    goto :menu
     
    Crunching for Team TPU
  7. SuddenG New Member

    Joined:
    May 6, 2009
    Messages:
    7 (0.00/day)
    Thanks Received:
    0
    worked like a charm. Thanks guys!
     
  8. Duxx Guest

    Click the little thanks button for him helping you out. 8)
     

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page