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

0 Members and 1 Guest are viewing this topic.

Lemonilla



    Apprentice
  • "Too sweet"
  • Thanked: 70
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: Batch Programs Thread.
« Reply #600 on: September 11, 2015, 05:16:46 PM »
Make a new thread.  This one is for sharing completed code.
Quote from: patio
God Bless the DOS Helpers...
Quote
If it compiles, send the files.

zask



    Intermediate

    • Experience: Experienced
    • OS: Other
    Re: Batch Programs Thread.
    « Reply #601 on: October 24, 2015, 03:54:20 PM »
    am i allowed to post a virus generator on here? it sends code safely to a text file

    patio

    • Moderator


    • Sage
    • Maud' Dib
    • Thanked: 1674
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #602 on: October 24, 2015, 07:03:19 PM »
    No.
       
     
    " Anyone who goes to a psychiatrist should have his head examined. "

    Salmon Trout



      Genius

      Thanked: 915
      • Yes
    • Computer: Specs
    • Experience: Experienced
    • OS: Other
    Re: Batch Programs Thread.
    « Reply #603 on: March 01, 2016, 10:18:15 AM »
    You should not make posts helping bypass school policy. Read the rules.

    patio

    • Moderator


    • Sage
    • Maud' Dib
    • Thanked: 1674
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #604 on: March 01, 2016, 04:59:27 PM »
    You should not make posts helping bypass school policy. Read the rules.

    Post removed...thanx for the heads up Salmon...
       
     
    " Anyone who goes to a psychiatrist should have his head examined. "

    DeScripter



      Starter

      • Experience: Familiar
      • OS: Windows 7
      Re: Batch Programs Thread.
      « Reply #605 on: March 22, 2017, 02:23:50 PM »
      I know a few people posted Rock Paper Scissors game codes already but I created one with a bit more. This version has ANIMATIONS!


      @echo off
      cls



      :idle
      cls
      echo.
      echo.
      echo.
      echo.
      echo.
      echo                     ______                           _______
      echo                    /      \__                 __/       \
      echo         __________/    ____^| ^|               ^| ^|____     \_____________
      echo                       /______^|               ^|______\
      echo                      /^|______^|              ^|______^|\
      echo                       ^|______^|              ^|______^|   
      echo         ________      ^|______^|              ^|______^|     _____________
      echo                 \_____\_____/                 \_____/____/
      echo.
      echo.
      echo               1) Rock              2) Paper       3) Scissors
                               


      set /p input=CHOICE:
      if %input%==1 goto Rock
      if %input%==2 goto Paper
      if %input%==3 goto Scissors


      :Rock

      set /a n=%random% %%3

      if %n%==0 goto RockRock
      if %n%==1 goto RockPaper
      if %n%==2 goto RockScissors



      :RockRock
      cls

      echo.
      echo                 TIE!
      echo.
      echo.
      echo.
      echo                     ______            _______
      echo                    /      \__      __/       \
      echo         __________/    ____^| ^|    ^| ^|____     \_____________
      echo                       /______^|    ^|______\
      echo                      /^|______^|    ^|______^|\
      echo                       ^|______^|    ^|______^|   
      echo         ________      ^|______^|    ^|______^|     ___________
      echo                 \_____\_____/      \_____/____/
       

      timeout /T 2 >nul
      goto idle



      :RockPaper
      cls

      echo.
      echo                  LOSS!
      echo.
      echo.
      echo.         
      echo                     ______                   _______
      echo                    /      \__        _______/       \
      echo         __________/    ____^| ^|      ^|_____ ^|____     \_____________
      echo                       /______^|     ^|______      \
      echo                      /^|______^|      ^|_____       
      echo                       ^|______^|       ^|_____        ________________
      echo         ________      ^|______^|         \__________/             
      echo                 \_____\_____/                   




      timeout /T 2 >nul
      goto idle


      :RockScissors
      cls

      echo.
      echo                  WIN!
      echo.
      echo.
      echo.
      echo                     ______                   _______
      echo                    /      \__       ________/       \
      echo         __________/    ____^| ^|     ^|_______^|____     \_____________
      echo                       /______^|      _______\    \
      echo                      /^|______^|     ^|____________ \
      echo                       ^|______^|           ^|______^|   
      echo         ________      ^|______^|           ^|______^|     ___________
      echo                 \_____\_____/             \_____/____/



      timeout /T 2 >nul
      goto idle




      :Paper

      cls
      set /a n=%random% %%3

      if %n%==0 goto PaperRock
      if %n%==1 goto PaperPaper
      if %n%==2 goto PaperScissors




      :PaperRock
      cls

      echo.
      echo                        WIN!
      echo.
      echo.
      echo.
      echo                     ______                         _______
      echo                    /      \________             __/       \
      echo         __________/    ____^| ______^|           ^| ^|____     \_____________
      echo                       /      _______^|          ^|______\
      echo                      /       ______^|           ^|______^|\
      echo         _________           ______^|            ^|______^|   
      echo                  \______________/              ^|______^|     ___________
      echo                                                 \_____/____/



      timeout /T 2 >nul
      goto idle


      :PaperPaper
      cls

      echo.
      echo                        TIE!
      echo.
      echo.
      echo.
      echo                     ______                         _______
      echo                    /      \________        _______/       \
      echo         __________/    ____^| ______^|      ^|______ ^|___     \_____________
      echo                       /      _______^|    ^|_______     \
      echo                      /       ______^|      ^|______      \
      echo         _________           ______^|        ^|______          _____________
      echo                  \______________/            \_____________/           



      timeout /T 2 >nul
      goto idle



      :PaperScissors
      cls

      echo.
      echo                    LOSS!
      echo.
      echo.
      echo.         
      echo                     ______                        _______
      echo                    /      \________      ________/       \
      echo         __________/    ____^| ______^|    ^|______ ^|____     \_____________
      echo                       /      _______^|    ______\     \
      echo                      /      _______^|    ^|____________ \
      echo         _________           ______^|           ^|______^|   
      echo                  \_____________/              ^|______^|     ___________
      echo                                                \_____/____/


      timeout /T 2 >nul
      goto idle


      :Scissors

      cls
      set /a n=%random% %%3

      if %n%==0 goto ScissorsRock
      if %n%==1 goto ScissorsPaper
      if %n%==2 goto ScissorsScissors


      :ScissorsRock
      cls

      echo.
      echo                    LOSS!
      echo.
      echo.
      echo.
      echo                     ______                    _______
      echo                    /      \_________       __/       \
      echo         __________/    ____^| _______^|     ^| ^|____     \_____________
      echo                       /     /_______      ^|______\
      echo                      / _____________^|     ^|______^|\
      echo                       ^|______^|            ^|______^|   
      echo         ________      ^|______^|            ^|______^|     ___________
      echo                 \_____\_____/              \_____/____/


      timeout /T 2 >nul
      goto idle


      :ScissorsPaper
      cls

      echo.
      echo                       WIN!
      echo.
      echo.
      echo.
      echo                     ______                        _______
      echo                    /      \________       _______/       \
      echo         __________/    ____^| ______^|     ^|_____ ^|____     \_____________
      echo                       /     /______     ^|______      \
      echo                      /^|____________^|     ^|_____       
      echo                       ^|______^|            ^|_____        ________________
      echo         ________      ^|______^|              \__________/             
      echo                 \_____\_____/   

      timeout /T 2 >nul
      goto idle


      :ScissorsScissors
      cls

      echo.
      echo                       TIE!
      echo.
      echo.
      echo.
      echo                     ______                         _______
      echo                    /      \_________      ________/       \
      echo         __________/    ____^| _______^|    ^|______^|____     \_____________
      echo                       /     /_______      ______\     \
      echo                      / _____________^|    ^|____________ \
      echo                       ^|______^|                 ^|______^|   
      echo         ________      ^|______^|                 ^|______^|     ___________
      echo                 \_____\_____/                   \_____/____/       


      timeout /T 2 >nul
      goto idle       






      BEAT THAT!

      kennysteele



        Newbie

        • Experience: Beginner
        • OS: Windows 7
        Re: Batch Programs Thread.
        « Reply #606 on: May 08, 2017, 02:21:07 AM »
        !!!!Urgent
        Can somone Help me with this please Urgent!!!

        For this you need to write two programs one in MS-DOS batch language and one in bash shellscript. Both will do the same task, to create files containing user records for another application (you do not need to worry what this is or write any aspect of it). Each of your programs will need to work in two modes, interactive mode and command line mode. Each will gather from the user their name and a username (which they can choose) which it will write to a file together with the current date and time) which must be stored in a folder called “user_records” (which your program will need to create if it does not exist). In the MS-DOS version user_records will be in “c:\”, in the bash version it will be in the current user’s login directory.
        The interactive mode will ask the user two questions, “What is your name?” (and get their reply) and “What is your chosen username?” (and again get their reply) you will need to add more to this such as an introduction at the start of the program, and report if the file was created etc.
         
        Say for example the user entered “Fred Bloggs” in answer to the first question and “fb1” to the second, and the date and time were 15/01/2017:20:21:02 then a file would be created in user_records named as per the username as fb1.txt (assuming this did not already exist – if it does exist your program should generate an error message) which would contain:
        Fred Bloggs
        fb1
        15/01/2017:20:21:02

        For the non-interactive mode the program would take the persons name and username on the command line, so, say the program was called “makeuser.bat” I might type in:
        makeuser.bat “Fred Bloggs” fb1
        and without asking the user any questions is should create the file as above. This version should also check that that exactly two parameters were given on the command line. If only one is given or more than two it should generate an error message.

        Salmon Trout



          Genius

          Thanked: 915
          • Yes
        • Computer: Specs
        • Experience: Experienced
        • OS: Other
        Re: Batch Programs Thread.
        « Reply #607 on: May 08, 2017, 02:30:01 AM »
        This is obviously a school assignment. Have you tried to write any code?

        kennysteele



          Newbie

          • Experience: Beginner
          • OS: Windows 7
          Re: Batch Programs Thread.
          « Reply #608 on: May 08, 2017, 02:43:52 AM »
          Nope I really Have not and yeah it is I really need Help its due in like 3 hours please would you be able to Help me out.

          Allan

          • Moderator

          • Mastermind
          • Thanked: 1196
          • Experience: Guru
          • OS: Windows 10
          Re: Batch Programs Thread.
          « Reply #609 on: May 08, 2017, 06:02:38 AM »
          Sorry, we won't do your homework for you.

          blanktheman



            Rookie
          • Technician
            • Yes
          • Certifications: List
          • Computer: Specs
          • Experience: Experienced
          • OS: Windows 10
          Re: Batch Programs Thread.
          « Reply #610 on: January 17, 2018, 12:49:35 AM »
          Very simple bat file. If my computer turns on and I'm not at work, it will switch off again. I've set it so after 1 hour of not being at work the computer will switch off but you can change the time.

          Code: [Select]
          @ECHO OFF

          :choice
          choice /C YN /D N /T 3600 /M "Are you at work today?"
          IF errorlevel 2 goto :imnothere
          IF errorlevel 1 goto :imhere
          pause
          goto :choice


          :imhere

          echo "I am here"
          exit

          :imnothere

          echo "I am not here"
          shutdown /s /f
          exit

          Salmon Trout



            Genius

            Thanked: 915
            • Yes
          • Computer: Specs
          • Experience: Experienced
          • OS: Other
          Re: Batch Programs Thread.
          « Reply #611 on: January 17, 2018, 01:22:04 AM »
          Did a ghost press the power button?