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 703802 times)

0 Members and 1 Guest are viewing this topic.

shanked



    Beginner
    • Experience: Familiar
    • OS: Windows Vista
    Re: Batch Programs Thread.
    « Reply #510 on: April 22, 2011, 12:44:34 AM »
    Although other people made this already I wanted to share my own RPS game :)

    Note: This looks somewhat similar to Carbon Dudeoxide's RPS (Near beginning of thread) but I suppose that it's just a coincidence.

    @echo off
    :here
    cls
    title RPS by Shanked
    set /a tries=0
    set /a ctries=0
    color 0a
    echo Enter your name:
    echo.
    set /p name=
    if "%name%"=="" goto :here
    if "%name%"==" " goto :here

    set A=%name%
    set length=0
    :loop
    if defined A (set A=%A:~1%&set /A length += 1&goto loop)
    set /a greater=10
    if %length% GTR %greater% goto :too high
    if %length% LEQ %greater% goto :top

    :top
    if %tries%==15 (
    goto :winner
    )
    if %ctries%==15 (
    goto :loser
    )

    cls
    echo ROCK PAPER OR SCISSORS!
    echo First one to reach 15 points WINS!
    echo.
    echo.
    echo                      %name% has %tries% points.
    echo                     The computer has %ctries% points.
    echo.
    if %tries%==14 (
    echo                     One more point for %name%!
    )
    if %ctries%==14 (
    echo                     One more point for the computer!
    )

    echo.
    echo Choose Rock, Paper, or Scissors
    echo.
    echo R is Rock
    echo P is Paper
    echo S is Scissors
    echo.

    set /p option=
    if "%option%"=="r" goto :rock
    if "%option%"=="p" goto :paper
    if "%option%"=="s" goto :scissors
    if "%option%"=="R" goto :rock
    if "%option%"=="P" goto :paper
    if "%option%"=="S" goto :scissors
    ) else (
    goto :top
    )
    )

    goto :top

    ::~~~~~~~~~~~~~~~~~~ROCK


    :rock
    @echo off
    cls
    set /a TV=%random%%%3+1


    if %TV% geq 3 goto :greaterrock
    if %TV% equ 2 goto :equalrock
    if %TV% leq 1 goto :lessrock

    :greaterrock
    cls
    echo %name% chose Rock and Computer chose Paper
    echo.
    echo Computer wins
    set /a ctries=%ctries +1
    echo.
    echo Computer gets a point
    pause >nul
    goto :top

    :equalrock
    cls
    echo %name% chose Rock and Computer chose Rock too
    echo.
    echo It's a TIE
    echo No points awarded
    pause >nul
    goto :top


    :lessrock
    cls
    echo %name% chose Rock and Computer chose Scissors
    echo.
    echo You won
    set /a tries=%tries +1
    echo.
    echo %name% gets a point
    pause >nul
    goto :top

    ::~~~~~~~~~~~~~~~~~PAPER

    :paper

    @echo off
    cls
    set /a TV1=%random%%%3+1

    if %TV1% geq 3 goto :greaterpaper
    if %TV1% equ 2 goto :equalpaper
    if %TV1% leq 1 goto :lesspaper

    :greaterpaper
    cls
    echo %name% chose Paper and Computer chose Scissors
    echo.
    echo Computer wins
    set /a ctries=%ctries +1
    echo.
    echo Computer gets a point
    pause >nul
    goto :top

    :equalpaper
    cls
    echo %name% chose Paper and Computer chose Paper too
    echo.
    echo It's a TIE
    echo No points awarded
    pause >nul
    goto :top

    :lesspaper
    cls
    echo %name% chose Paper and Computer chose Rock
    echo.
    echo You won
    set /a tries=%tries +1
    echo.
    echo %name% gets a point
    pause >nul
    goto :top

    ::~~~~~~~~~~~~~~~~~~SCISSORS

    :scissors

    @echo off
    cls
    set /a TV2=%random%%%3+1


    if %TV2% geq 3 goto :greatersci
    if %TV2% equ 2 goto :equalsci
    if %TV2% leq 1 goto :lesssci

    :greatersci
    cls
    echo %name% chose Scissors and Computer chose Rock
    echo.
    echo Computer wins
    set /a ctries=%ctries +1
    echo.
    echo Computer gets a point
    pause >nul
    goto :top

    :equalsci
    cls
    echo %name% chose Scissors and Computer chose Scissors too
    echo.
    echo It's a TIE
    echo No points awarded
    pause >nul
    goto :top

    :lesssci
    cls
    echo %name% chose Scissors and Computer chose Paper
    echo.
    echo You won
    set /a tries=%tries +1
    echo.
    echo %name% gets a point
    pause >nul
    goto :top


    :winner
    cls
    echo Good Job! You won against the computer! :O
    timeout 3 >nul
    pause >nul
    pause >nul
    exit

    :loser
    cls
    echo Wow you lost by a computer...you suck
    pause >nul
    pause >nul
    exit

    :too high
    cls
    color 0f
    echo You have entered too many letters
    echo.
    echo Press any key to try again
    pause >nul
    cls
    goto :here

    ...

    millergram



      Rookie

      • Experience: Beginner
      • OS: Windows Vista
      Re: Batch Programs Thread.
      « Reply #511 on: April 22, 2011, 09:30:45 PM »
      Code: [Select]
      Lines=30 Col=68
      @echo off
      :main1
      set tries=5
      set /a guess=%random% %%99 + 1 >nul
      :main
      if %tries%==0 goto loss
      cls
      Echo.This is 1-100 guess a number if you get it right then you win
      echo.%username% has %tries% tries left
      echo.Your guess below
      set /p user=
      set /a tries=%tries%-1
      if "%user%"=="%guess%" goto win
      if "%user%"=="" goto main
      if "%user%" LSS "%guess%" echo To low &pause
      if "%user%" GTR "%guess%" echo To high &pause
      goto main
      :win
      cls
      echo.you win! play again?(yes/no)
      set /p yinput=
      if "%yinput%"=="yes" goto main1
      if "%yinput%"=="no" exit
      if "%yinput%"=="" goto win
      :loss
      cls
      echo.sorry you loose
      echo.The number was %guess%
      pause
      its actually pretty fun when ur board

      millergram



        Rookie

        • Experience: Beginner
        • OS: Windows Vista
        Re: Batch Programs Thread.
        « Reply #512 on: July 05, 2011, 06:19:53 PM »
        Simpler batch timer fpr a shutdown Delays however many Hours,mins,seconds till shutdown
        Code: [Select]
        @echo off
        title Shutdown Timer v1.00
        mode con: cols=50 lines=15
        :main
        cls
        echo.Welcome To Shutdown Timer
        set /p input2=Seconds=
        set /p input=Minutes=
        set /p input4=Hours=
        set /a input=%input%*60
        set /a input4=%input4%*60*60
        set /a input3=%input%+%input2%+%input4%
        timeout /t %input3% /nobreak
        shutdown /s
        echo.shutting down!
        pause>nul
        welcome boda da bi bi

        foxhound

        • Guest
        Re: Batch Programs Thread.
        « Reply #513 on: August 14, 2011, 12:47:15 PM »
        Code: [Select]
        set /p %save%=Save as...
        ffmpeg.exe -i %1 -sameq -ab 192k %save%

        I rip a lot of FLV files off of video sites ( all within the public domain of course  ;) ) and then use FFmpeg to convert them to MP3. This two-liner batch presets ffmpeg with my usual arguments. All I have to do is drag and drop the file into the batch file to start the process.

        labadiena112



          Newbie

          • Experience: Beginner
          • OS: Unknown
          Re: Batch Programs Thread.
          « Reply #514 on: August 20, 2011, 11:22:32 AM »
          try this tutorial (there is also a game in it):

          Link Removed...
          « Last Edit: August 20, 2011, 11:41:31 AM by patio »

          millergram



            Rookie

            • Experience: Beginner
            • OS: Windows Vista
            Re: Batch Programs Thread.
            « Reply #515 on: September 19, 2011, 09:50:07 PM »
            Shutdown Timer Perfected
            Last Time im Gonna Do this i think!?

            Code: [Select]
            @echo off
            title Shutdown Timer v1.00
            mode con: cols=50 lines=15
            :main
            cls
            echo.Welcome To Shutdown Timer
            if "%input2%"=="" set input2=0
            if "%input%"=="" set input=0
            if "%input4%"=="" set input4=0
            set /p input2=Seconds=
            set /p input=Minutes=
            set /p input4=Hours=
            set /a input=%input%*60
            set /a input4=%input4%*60*60
            set /a input3=%input%+%input2%+%input4%
            timeout /t %input3% /nobreak
            shutdown /s
            echo.shutting down!
            pause>nul

            col. sanders



              Rookie

              • Experience: Beginner
              • OS: Unknown
              Re: Batch Programs Thread.
              « Reply #516 on: November 01, 2011, 11:01:27 AM »
              This little VBScript renames the Computer Name to it's Service Tag#/Serial Number for easier tracking of computers.  Only works for computers that ARE NOT joined to a domain.

              Code: [Select]
              WScript.Echo "Before selecting the OK button, please save any" & _
              " documents that need to be saved."

              strComputer = "."

              Set objWMIService = GetObject("winmgmts:" & _
              "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

              For Each objSMBIOS in objWMIService.ExecQuery("Select * from Win32_SystemEnclosure")
              ' The below variable will be used in the next For Each statement.
              Dim Name
              Name = objSMBIOS.SerialNumber

              Next

              Set objWMIService = GetObject("Winmgmts:root\cimv2")

              ' This section renames the computer.
              For Each objComputer in _
                  objWMIService.InstancesOf("Win32_ComputerSystem")

                      Result = objComputer.rename(Name)
                      If Result <> 0 Then
                         WScript.Echo "Rename failed. Error = " & Err.Number
                      Else
                         WScript.Echo "Rename successful." & _
                             "  Your machine will reboot after clicking the OK button.  Once again, make sure you have saved any documents before clicking OK.  NOTE: IF YOU CLICK THE 'X' AT THE TOP RIGHT CORNER OF THE WINDOW, IT WILL REBOOT THE COMPUTER AS WELL."
                      End If

              Next
              'Reboots the computer.
              Set OpSysSet = GetObject("winmgmts:{authenticationlevel=Pkt," _     
              & "(Shutdown)}").ExecQuery("select * from Win32_OperatingSystem where "_     
              & "Primary=true")
              for each OpSys in OpSysSet     
              retVal = OpSys.Reboot()
              next

              lmsmi1



                Rookie

                • Experience: Beginner
                • OS: Windows XP
                Re: Batch Programs Thread.
                « Reply #517 on: November 05, 2011, 10:57:14 AM »
                Hello, I'm new here and I have been searching the web for a place to put my batch files, I finally found THIS! Yay! Ok, here is my fake batch virus scanner (it's lame because I'm a total noob at batch):

                Code: [Select]
                @echo off
                title Virus Scanner
                echo Press 1 Then ENTER To Do An Advanced And Complete Scan
                echo Press 2 Then ENTER To Do A Quick Scan
                set /p car=
                if %car% == 1 goto advcmp
                if %car% == 2 goto qik
                :advcmp
                cls
                echo Scanning
                ping localhost -n 2 >nul
                cls
                echo Scanning.
                ping localhost -n 2 >nul
                cls
                echo Scanning..
                ping localhost -n 2 >nul
                cls
                echo Scanning...
                ping localhost -n 2 >nul
                cls
                echo Virus Scanner found a few infections, press 1 to move them to the vault.
                echo Press 2 to ignore them.
                set /p choose=
                if %choose% == 1 goto delete
                if %choose% == 2 goto ignore
                :delete
                cls
                echo Moving To Vault
                ping localhost -n 2 >nul
                cls
                echo Moving To Vault.
                ping localhost -n 2 >nul
                cls
                echo Moving To Vault..
                ping localhost -n 2 >nul
                cls
                echo Moving To Vault...
                ping localhost -n 2 >nul
                cls
                echo Virus Scanner successfully moved the infections to its vault! Press ENTER to    close this window.
                pause >nul
                exit
                :ignore
                cls
                echo The infections were ignored.
                pause
                exit
                :qik
                cls
                echo Virus Scanner found a few infections, press 1 to move them to the vault.
                echo Press 2 to ignore them.
                set /p choose=
                if %choose% == 1 goto delete
                if %choose% == 2 goto ignore
                :delete
                cls
                echo Moving To Vault
                ping localhost -n 2 >nul
                cls
                echo Moving To Vault.
                ping localhost -n 2 >nul
                cls
                echo Moving To Vault..
                ping localhost -n 2 >nul
                cls
                echo Moving To Vault...
                ping localhost -n 2 >nul
                cls
                echo Virus Scanner successfully moved the infections to its vault! Press ENTER to    close this window.
                pause >nul
                exit
                :ignore
                cls
                echo The infections were ignored. Press ENTER to close this window.
                pause >nul
                exit

                Salmon Trout

                • Guest
                Re: Batch Programs Thread.
                « Reply #518 on: November 05, 2011, 11:54:24 AM »
                here is my fake batch virus scanner

                It's lame, but mainly because the idea of a fake virus scanner is lame. What possible point could there be in it?

                patio

                • Moderator


                • Genius
                • Maud' Dib
                • Thanked: 1769
                  • Yes
                • Experience: Beginner
                • OS: Windows 7
                Re: Batch Programs Thread.
                « Reply #519 on: November 05, 2011, 12:06:15 PM »
                It showed my PC as clean as a whistle...
                I couldn't find the vault however...
                " Anyone who goes to a psychiatrist should have his head examined. "

                lmsmi1



                  Rookie

                  • Experience: Beginner
                  • OS: Windows XP
                  Re: Batch Programs Thread.
                  « Reply #520 on: November 05, 2011, 01:50:30 PM »
                  patio, about your profile:

                  When you say "Maud Dib", do you mean "ModDB"? As in, the mod database website?

                  Salmon Trout

                  • Guest
                  Re: Batch Programs Thread.
                  « Reply #521 on: November 05, 2011, 02:13:15 PM »
                  When you say "Maud Dib", do you mean "ModDB"? As in, the mod database website?

                  I hope he won't mind me jumping in and saying "No he doesn't".

                  http://lmgtfy.com/?q=Maud+Dib

                  exposes Patio's spelling mistake... Or is it?



                  lmsmi1



                    Rookie

                    • Experience: Beginner
                    • OS: Windows XP
                    Re: Batch Programs Thread.
                    « Reply #522 on: November 05, 2011, 06:06:09 PM »
                    Here is my fake batch DNS Cache Cleaner:

                    Code: [Select]
                    @echo off
                    title DNS Cleaner ~by lmsmi1
                    color 0a
                    echo -----------------------------
                    echo -------DNS Cleaner-----------
                    echo -----------------------------
                    echo --------by lmsmi1------------
                    echo -----------------------------
                    echo .
                    echo .
                    echo Press 1 Then ENTER To Do A Quick Cleanup
                    echo Press 2 Then ENTER To Do A Complete Cleanup
                    set /p cleanup=
                    if %cleanup% == 1 goto qik
                    if %cleanup% == 2 goto cmp
                    :qik
                    REM Clear DNS Cache
                    cls
                    echo Quick clean was successfully completed! Press ENTER to close DNS Cleaner.
                    pause >nul
                    exit
                    :cmp
                    REM Clear DNS Cache
                    cls
                    echo Cleaning
                    ping localhost -n 2 >nul
                    cls
                    echo Cleaning.
                    ping localhost -n 2 >nul
                    cls
                    echo Cleaning..
                    ping localhost -n 2 >nul
                    cls
                    echo Cleaning...
                    ping localhost -n 2 >nul
                    cls
                    echo Complete clean was successfully completed! Press ENTER to close DNS Cleaner.
                    pause >nul
                    exit

                    Salmon Trout

                    • Guest
                    Re: Batch Programs Thread.
                    « Reply #523 on: November 05, 2011, 06:08:59 PM »
                    What is the point of these fake scripts?

                    lmsmi1



                      Rookie

                      • Experience: Beginner
                      • OS: Windows XP
                      Re: Batch Programs Thread.
                      « Reply #524 on: November 05, 2011, 06:14:57 PM »
                      Here is my fake internet connector: (it says it connects you to the internet :P)

                      Code: [Select]
                      @echo off
                      title Internet Connector ~by lmsmi1
                      color 0a
                      echo -----------------------------
                      echo ----Internet Connector-------
                      echo -----------------------------
                      echo --------by lmsmi1------------
                      echo -----------------------------
                      echo .
                      echo .
                      echo Press 1 Then ENTER To Connect To The Internet
                      echo Press 2 Then ENTER To Exit
                      set /p connect=
                      if %connect% == 1 goto cnct
                      if %connect% == 2 goto clr
                      :cnct
                      REM Connect To Internet
                      cls
                      echo Connecting
                      ping localhost -n 2 >nul
                      cls
                      echo Connecting.
                      ping localhost -n 2 >nul
                      cls
                      echo Connecting..
                      ping localhost -n 2 >nul
                      cls
                      echo Connecting...
                      ping localhost -n 2 >nul
                      cls
                      echo Internet Connector successfully connected to the internet! Press ENTER to close Internet Connector.
                      pause >nul
                      exit
                      :clr
                      exit