Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch Programs Thread.  (Read 652357 times)

0 Members and 1 Guest are viewing this topic.

Sky Ninja



    Rookie

  • *headdesk*
    Re: Batch Programs Thread.
    « Reply #60 on: August 23, 2008, 08:28:50 PM »
    It still just flashes for me, but I think that it's because choice doesn't work on XP.
    Anyway, I made a batch program that generates a random level name for the game SRB2. Someone else made a similar program, but in C++. ::)
    Code: [Select]
    ::Batch file designed by Sky Ninja
    @echo off
    set base=none
    set sec=none
    color 1f
    title SRB2 Level Name Generator
    :start:
    cls
    set /a g=(%random% %%15)+1
    if %g% equ 1 set base=Green
    if %g% equ 2 set base=Glowing
    if %g% equ 3 set base=Egg
    if %g% equ 4 set base=Clover
    if %g% equ 5 set base=Lunar
    if %g% equ 6 set base=Radiant
    if %g% equ 7 set base=Hidden
    if %g% equ 8 set base=Flaming
    if %g% equ 9 set base=Frozen
    if %g% equ 10 set base=Dark
    if %g% equ 11 set base=Sandy
    if %g% equ 12 set base=Final
    if %g% equ 13 set base=Lost
    if %g% equ 14 set base=Fatal
    if %g% equ 15 set base=Weapons
    set /a h=(%random% %%10)+1
    if %h% equ 1 set sec=Hill
    if %h% equ 2 set sec=Shrine
    if %h% equ 3 set sec=Factory
    if %h% equ 4 set sec=Base
    if %h% equ 5 set sec=City
    if %h% equ 6 set sec=Field
    if %h% equ 7 set sec=Dunes
    if %h% equ 8 set sec=Mountain
    if %h% equ 9 set sec=Core
    if %h% equ 10 set sec=Attack
    echo. Your level is...
    echo %base% %sec% Zone>>"C:\Documents and Settings\%username%\My Documents\LevelNameGen.txt"
    echo. %base% %sec% Zone
    echo. 
    echo. Generate another? (y/n)
    Set /p yn= :
    if %yn% equ y goto start
    if %yn% equ n exit
    « Last Edit: August 23, 2008, 10:07:41 PM by Sky Ninja »

    fireballs



      Apprentice

    • Code:Terminal
    • Thanked: 3
      Re: Batch Programs Thread.
      « Reply #61 on: August 24, 2008, 02:07:30 AM »
      inspired by devcom i made a file explorer.
      Code: [Select]
      @echo off
      mode con lines=20 cols=60
      :start
      cls
      echo you are here: %CD%
      echo.
      echo.Up?            -W
      echo.Open?          -A
      echo.Search?        -S
      echo.Enter address? -D
      echo.Quit           -Q
      echo.CMD?           -Z
      echo.rename?        -R
      echo.copy?          -c
      choice /c "WADQSRZC">Nul
      if errorlevel 8 goto C
      if errorlevel 7 goto Z
      if errorlevel 6 goto R
      if errorlevel 5 goto S
      if errorlevel 4 goto Q
      if errorlevel 3 goto D
      if errorlevel 2 goto A
      if errorlevel 1 goto W
      echo error!!!
      pause
      exit

      :C
      echo.
      set /p OR=what do you want to copy?
      if "%OR%"=="back" goto start
      set /p nom= where to?
      copy %OR% %nom%
      goto start

      :D
      echo.
      set /p add=where do you want to go?
      if "%add%"=="back" goto start
      cd %add%
      goto start

      :W
      cd..
      goto start

      :A
      echo.
      dir /a:-d /b
      echo.
      set /p add=what do you want to run?
      if "%add%"=="back" goto start
      start "" %add%
      goto start

      :Q
      echo bye
      exit

      :S
      set /p OR=where do you want to search?
      if "%OR%"=="back" goto start
      set /p add=what do you want to search for?
      where /R %OR% "%add%"
      pause
      goto start

      :R
      set /p OR=what would you like to rename?
      if "%OR%"=="back" goto start
      set /p nom=rename to what?
      ren %OR% %nom%
      goto start

      :Z
      set /p add=%CD%^>
      if "%add%"=="back" goto start
      %add%
      pause
      goto start
      Next time google it.

      devcom



        Apprentice

        Thanked: 37
        Re: Batch Programs Thread.
        « Reply #62 on: August 24, 2008, 08:49:05 AM »
        ok ive attached file and should work for all now even on xp ;)

        EDIT:
        try now

        [recovering disk space -- attachment deleted by admin]
        « Last Edit: August 24, 2008, 10:33:09 AM by devcom »
        Download: Choice.exe

        Sky Ninja



          Rookie

        • *headdesk*
          Re: Batch Programs Thread.
          « Reply #63 on: August 24, 2008, 09:10:16 AM »
          Nope. Choice in not recognised as a valid win32 application. It tries to work, but choice is uncompatable.

          devcom



            Apprentice

            Thanked: 37
            Re: Batch Programs Thread.
            « Reply #64 on: August 25, 2008, 11:50:46 AM »
            c'mon guys post your 'things' ;)
            Download: Choice.exe

            fireballs



              Apprentice

            • Code:Terminal
            • Thanked: 3
              Re: Batch Programs Thread.
              « Reply #65 on: August 25, 2008, 01:04:01 PM »
              ... you want to see my 'thing'... usually i'd wait until after the first date but seeing as you asked so politely.... ;)

              FB
              Next time google it.

              devcom



                Apprentice

                Thanked: 37
                Re: Batch Programs Thread.
                « Reply #66 on: August 25, 2008, 03:31:47 PM »
                Quote
                ... you want to see my 'thing'... usually i'd wait until after the first date but seeing as you asked so politely....
                lol :D

                here is link to my file ex should work on XP to now

                http://www.computerhope.com/forum/index.php?action=dlattach;topic=59426.0;attach=5360
                Download: Choice.exe

                fireballs



                  Apprentice

                • Code:Terminal
                • Thanked: 3
                  Re: Batch Programs Thread.
                  « Reply #67 on: August 25, 2008, 03:39:19 PM »
                  I can't get the file ex to work. I am using vista but it just displays a message blinks then displays the same message like it's in a loop.

                  I still prefer my version ;)

                  FB
                  Next time google it.

                  macdad-

                    Topic Starter


                    Expert

                    Thanked: 40
                    Re: Batch Programs Thread.
                    « Reply #68 on: August 25, 2008, 03:51:35 PM »
                    add a colon between the /C and the wsdafjo on this line like this
                    Code: [Select]
                    choice /C:wsdafjo >nul
                    If you dont know DOS, you dont know Windows...

                    Thats why Bill Gates created the Windows NT Family.

                    devcom



                      Apprentice

                      Thanked: 37
                      Re: Batch Programs Thread.
                      « Reply #69 on: August 25, 2008, 03:57:28 PM »
                      thats imposible becouse ive copied.exe choice from windows\system32 so it should work normal, and better that pressing for ex. a and then enter each time

                      and about that colon it works for me without and well i will add it in future scripts
                      Download: Choice.exe

                      fireballs



                        Apprentice

                      • Code:Terminal
                      • Thanked: 3
                        Re: Batch Programs Thread.
                        « Reply #70 on: August 25, 2008, 04:02:20 PM »
                        after putting in .../c:w... i get an error on this line:
                        Quote
                        for /F "delims=? skip=%nnum%" %%L in ('dir /B /A:D %cd%') do (
                        cd %%L
                        goto CD
                        )

                        saying
                        Quote
                        " was unexpected at this time.

                        FB
                        Next time google it.

                        macdad-

                          Topic Starter


                          Expert

                          Thanked: 40
                          Re: Batch Programs Thread.
                          « Reply #71 on: August 25, 2008, 04:04:03 PM »
                          huh....the only prob i had was the blinking on the choice command and the colon solved the prob. I have Windows 2000 Pro but i didnt have a problem on that line.
                          If you dont know DOS, you dont know Windows...

                          Thats why Bill Gates created the Windows NT Family.

                          devcom



                            Apprentice

                            Thanked: 37
                            Re: Batch Programs Thread.
                            « Reply #72 on: August 25, 2008, 04:15:10 PM »
                            try to change
                            Code: [Select]
                            if %cnum% equ 1 (
                            for /F "delims=?" %%L in ('dir /B /A:D %cd%') do (
                            cd %%L
                            goto CD
                            )
                            )
                            to
                            Code: [Select]
                            if %cnum% leq 1 (
                            for /F "delims=?" %%L in ('dir /B /A:D %cd%') do (
                            cd %%L
                            goto CD
                            )
                            )

                            i think you are trying to go in higher dir when there isnt higher dir
                            Download: Choice.exe

                            fireballs



                              Apprentice

                            • Code:Terminal
                            • Thanked: 3
                              Re: Batch Programs Thread.
                              « Reply #73 on: August 25, 2008, 04:21:12 PM »
                              at least mine works  :P :P

                              FB
                              Next time google it.

                              Sky Ninja



                                Rookie

                              • *headdesk*
                                Re: Batch Programs Thread.
                                « Reply #74 on: August 26, 2008, 05:12:43 PM »
                                Choice doesn't work on XP.
                                Quote
                                Microsoft Windows 2000 and Windows XP users who have batch files that utilize the choice command should modify the batch file to use the MS-DOS set command.