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

0 Members and 3 Guests are viewing this topic.

patio

  • Moderator


  • Genius
  • Maud' Dib
  • Thanked: 1769
    • Yes
  • Experience: Beginner
  • OS: Windows 7
Re: Batch Programs Thread.
« Reply #495 on: February 15, 2011, 11:40:34 AM »
How would that hold anyone's attention ? ?
" Anyone who goes to a psychiatrist should have his head examined. "

Salmon Trout

  • Guest
Re: Batch Programs Thread.
« Reply #496 on: February 15, 2011, 11:46:20 AM »
It would make me curse and hit CTRL + C and find out who had done it and punch their silly head.

millergram



    Rookie

    • Experience: Beginner
    • OS: Windows Vista
    Re: Batch Programs Thread.
    « Reply #497 on: February 16, 2011, 03:25:28 PM »
    Another random batch or an update to one
    Code: [Select]
    :mans
    @echo off
    set a=0
    set b=0
    :main
    set /a b=%b%+1
    if %a%==2500 goto stop
    set /a a=(%random% %%25000)+1
    echo %a%
    goto main

    :stop
    echo.Times Till %a% reached=%b%
    pause
    goto cmd

    :cmd
    set /p K=Wanna go Again?
    if /i "%K%"=="yes" goto mans
    echo.yes or no?
    goto cmd[code/]

    patio

    • Moderator


    • Genius
    • Maud' Dib
    • Thanked: 1769
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #498 on: February 16, 2011, 03:54:22 PM »
    Breathtaking...
    " Anyone who goes to a psychiatrist should have his head examined. "

    1998golfer



      Greenhorn

      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #499 on: March 04, 2011, 03:32:37 PM »
    Another random batch or an update to one
    Code: [Select]
    :mans
    @echo off
    set a=0
    set b=0
    :main
    set /a b=%b%+1
    if %a%==2500 goto stop
    set /a a=(%random% %%25000)+1
    echo %a%
    goto main
    :stop
    echo.Times Till %a% reached=%b%
    pause
    goto cmd[/quote]

    :cmd
    set /p K=Wanna go Again?
    if /i "%K%"=="yes" goto mans
    echo.yes or no?
    goto cmd[code/]

    i made one that does the same thing but is a lot simpler!

    @echo off
    :top
    echo %random%
    echo %random%
    goto top


    « Last Edit: March 04, 2011, 03:47:19 PM by 1998golfer »

    Salmon Trout

    • Guest
    Re: Batch Programs Thread.
    « Reply #500 on: March 04, 2011, 04:24:20 PM »
    i made one that does the same thing but is a lot simpler!

    That's because it doesn't do the "same thing".

    1998golfer



      Greenhorn

      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #501 on: March 09, 2011, 07:41:13 PM »
    That's because it doesn't do the "same thing".

    Oh, sorry i didnt wait to see the end of the longer one

    1998golfer



      Greenhorn

      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #502 on: March 09, 2011, 07:42:54 PM »
    Hey Guys! i had to do a book report :-[ so i decided to do a quiz through a batch file! the book is fablehaven book 4, tell me what you think!
    Code: [Select]
    @echo off
    ::~~This line below makes the screen bigger
    mode con lines=70 cols=140
    Color 80
    Title "Fablehaven Book 4 Quiz"
    Echo. There are 5 questions about fablehaven coming up. Raise your hand if you know the answer.
    Pause
    :1
    Echo. Question 1
    Echo. ________________________________________________________
    Echo. What is the last name of Kendra and Seth's Grandparents?
    Echo. Type the number of the answer.
    Echo. 1. Sakenberg
    Echo. 2. Sorenson
    Echo. 3. Moronsen
    Echo. 4. Jackson
    set /p TP= :

    if '%TP%' == '1' goto :wrong1
    if '%TP%' == '2' goto :correct1
    if '%TP%' == '3' goto :wrong1
    if '%TP%' == '4' goto :wrong1


    :wrong1
    Echo. You fail... Press a button to try again.
    pause
    goto :1

    :correct1
    Echo. Great job! you got it right! Press a button to go to the next question.
    pause
    goto :2

    :2
    Echo. Question 2
    Echo. _________________________________________________________________________
    Echo. What is the name that Navarog was disguised as when he was in human form?
    Echo. Type the number of the answer.
    Echo. 1. Gunther
    Echo. 2. Tursy
    Echo. 3. Perceus
    Echo. 4. Gavin
    set /p TL= :

    if '%TL%' == '1' goto :wrong2
    if '%TL%' == '2' goto :wrong2
    if '%TL%' == '3' goto :wrong2
    if '%TL%' == '4' goto :correct2

    :wrong2
    Echo. YOu fail... Press a button to try again.
    pause
    goto :2

    :correct2
    Echo. Great job! you got it right! Press a button to go to the next question.
    pause
    goto :3

    :3
    Echo. Question 3
    Echo. _________________________________________________________________
    Echo. What dragon killed Navarog?
    Echo. Type the number of the answer.
    Echo. 1. Annabeth
    Echo. 2. Rhombus
    Echo. 3. Raxtus
    Echo. 4. The Con Man
    set /p TM= :

    if '%TM%' == '1' goto :wrong3
    if '%TM%' == '2' goto :wrong3
    if '%TM%' == '3' goto :correct3
    if '%TM%' == '4' goto :wrong3

    :wrong3
    Echo. You fail... Press a button to try again.
    pause
    goto :3

    :correct3
    Echo. Great job! you got it right! Press a button to go to the next question.
    pause
    goto :4

    :4
    Echo. Question 4
    Echo. _____________________________________
    Echo. How many keys are there to the Zzyzx?
    Echo. Type the number of the answer.
    Echo. 1. 1
    Echo. 2. 3
    Echo. 3. 5
    Echo. 4. None, you use magic.
    set /p TQ= :

    if '%TQ%' == '1' goto :wrong4
    if '%TQ%' == '2' goto :wrong4
    if '%TQ%' == '3' goto :correct4
    if '%TQ%' == '4' goto :wrong4

    :wrong4
    Echo. You fail... Press a button to try again.
    pause
    goto :4

    :correct4
    Echo. Great job! you got it right! Press a button to go to the next question.
    pause
    goto :5

    :5
    Echo. Question 5
    Echo. _____________________________________
    Echo. Which country is Obsidan Waste in?
    Echo. Type the number of the answer.
    Echo. 1. Asia
    Echo. 2. Brazil
    Echo. 3. Australia
    Echo. 4. Botswana
    set /p TW= :

    if '%TW%' == '1' goto :wrong5
    if '%TW%' == '2' goto :wrong5
    if '%TW%' == '3' goto :Correct5
    if '%TW%' == '4' goto :wrong5

    :wrong5
    Echo. You fail... Press a button to try again.
    pause
    goto :5

    :correct5
    Echo. Great Job! you finished the quiz!
    pause
    end





    Salmon Trout

    • Guest
    Re: Batch Programs Thread.
    « Reply #503 on: March 10, 2011, 12:10:00 AM »
    Hey Guys! i had to do a book report :-[ so i decided to do a quiz through a batch file! the book is fablehaven book 4, tell me what you think!

    Isn't a book report supposed to be, like a report about a, er,  book? Just asking.

    patio

    • Moderator


    • Genius
    • Maud' Dib
    • Thanked: 1769
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #504 on: March 12, 2011, 08:47:59 AM »
    Isn't a book report supposed to be, like a report about a, er,  book? Just asking.

    Thank goodness it wasn't a Science project...
    " Anyone who goes to a psychiatrist should have his head examined. "

    1998golfer



      Greenhorn

      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #505 on: March 12, 2011, 07:26:26 PM »
    Isn't a book report supposed to be, like a report about a, er,  book? Just asking.
    I meant... like my class does PROJECTS for "book reports" sorry.

    1998golfer



      Greenhorn

      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #506 on: March 12, 2011, 07:30:30 PM »


    Hi i edited it so it goes to a new page when you go to a new question.


    Code: [Select]
    @echo off
    ::~~This line below makes the screen bigger
    mode con lines=70 cols=140
    Color 80
    Title "Fablehaven Book 4 Quiz"
    Echo. There are 5 questions about fablehaven coming up. Raise your hand if you know the answer.
    Pause
    :1
    cls
    Echo. Question 1
    Echo. ________________________________________________________
    Echo. What is the last name of Kendra and Seth's Grandparents?
    Echo. Type the number of the answer.
    Echo. 1. Sakenberg
    Echo. 2. Sorenson
    Echo. 3. Moronsen
    Echo. 4. Jackson
    set /p TP= :

    if '%TP%' == '1' goto :wrong1
    if '%TP%' == '2' goto :correct1
    if '%TP%' == '3' goto :wrong1
    if '%TP%' == '4' goto :wrong1


    :wrong1
    Echo. You fail... Press a button to try again.
    pause
    goto :1

    :correct1
    Echo. Great job! you got it right! Press a button to go to the next question.
    pause
    goto :2

    :2
    cls
    Echo. Question 2
    Echo. _________________________________________________________________________
    Echo. What is the name that Navarog was disguised as when he was in human form?
    Echo. Type the number of the answer.
    Echo. 1. Gunther
    Echo. 2. Tursy
    Echo. 3. Perceus
    Echo. 4. Gavin
    set /p TL= :

    if '%TL%' == '1' goto :wrong2
    if '%TL%' == '2' goto :wrong2
    if '%TL%' == '3' goto :wrong2
    if '%TL%' == '4' goto :correct2

    :wrong2
    Echo. YOu fail... Press a button to try again.
    pause
    goto :2

    :correct2
    Echo. Great job! you got it right! Press a button to go to the next question.
    pause
    goto :3

    :3
    cls
    Echo. Question 3
    Echo. _________________________________________________________________
    Echo. What dragon killed Navarog?
    Echo. Type the number of the answer.
    Echo. 1. Annabeth
    Echo. 2. Rhombus
    Echo. 3. Raxtus
    Echo. 4. The Con Man
    set /p TM= :

    if '%TM%' == '1' goto :wrong3
    if '%TM%' == '2' goto :wrong3
    if '%TM%' == '3' goto :correct3
    if '%TM%' == '4' goto :wrong3

    :wrong3
    Echo. You fail... Press a button to try again.
    pause
    goto :3

    :correct3
    Echo. Great job! you got it right! Press a button to go to the next question.
    pause
    goto :4

    :4
    cls
    Echo. Question 4
    Echo. _____________________________________
    Echo. How many keys are there to the Zzyzx?
    Echo. Type the number of the answer.
    Echo. 1. 1
    Echo. 2. 3
    Echo. 3. 5
    Echo. 4. None, you use magic.
    set /p TQ= :

    if '%TQ%' == '1' goto :wrong4
    if '%TQ%' == '2' goto :wrong4
    if '%TQ%' == '3' goto :correct4
    if '%TQ%' == '4' goto :wrong4

    :wrong4
    Echo. You fail... Press a button to try again.
    pause
    goto :4

    :correct4
    Echo. Great job! you got it right! Press a button to go to the next question.
    pause
    goto :5

    :5
    cls
    Echo. Question 5
    Echo. _____________________________________
    Echo. Which country is Obsidan Waste in?
    Echo. Type the number of the answer.
    Echo. 1. Asia
    Echo. 2. Brazil
    Echo. 3. Australia
    Echo. 4. Botswana
    set /p TW= :

    if '%TW%' == '1' goto :wrong5
    if '%TW%' == '2' goto :wrong5
    if '%TW%' == '3' goto :Correct5
    if '%TW%' == '4' goto :wrong5

    :wrong5
    Echo. You fail... Press a button to try again.
    pause
    goto :5

    :correct5
    Echo. Great Job! you finished the quiz!
    pause
    end





    Dundir



      Rookie

      • Yes
    • Experience: Experienced
    • OS: Windows 7
    Re: Batch Programs Thread.
    « Reply #507 on: March 21, 2011, 05:21:10 PM »
    Two scripts, one for installing a bunch of microsoft update files through drag dropping the list on install.bat and beeping when finished, as well as a program for generating the lists. Assuming your system drive is c:\
    The beeping requires a text file called beep.txt, this is made by using copy con beep.txt and then typing ctrl g ctrl z enter.
    I hope you find it useful.
    install.bat
    Code: [Select]
    @echo off
    cls

    REM ----------------------------------------------

    :install

    echo Installing Please Wait . . . . . .

    FOR /F "useback tokens=1,2,3* delims=," %%i IN (%1) DO (
    REM echo %%i%%j%%k 

    set /p t="%%k ...... "< NUL
    START /WAIT "" "%%i%%j%%k" /norestart /quiet
    echo OK
    )
    type beep.txt

    generate.bat
    Code: [Select]
    @echo off
    setlocal enabledelayedexpansion


    set curpath=%~pd0%
    set /p var=Generating Lists . . . .  < NUL
    REM |-- sends old path to a text file for later retrieval
    path > oldpath.txt
    FOR /F "tokens=1 delims=" %%i IN (oldpath.txt) DO set str=%%i

    REM |-- Cuts out first 5 characters of string and then adds C:\ to path
    set str=%str:~5%
    set str=%str%C:\;
    set path=%str%


    REM |-- Checks if list.bat is placed at c:\ for upcoming loop
    if not exist C:\list.bat copy list.bat c:\ > NUL

    REM |-------------------------------------------------------|

    FOR /F "tokens=1" %%i IN (path.txt) DO (

    chdir %curpath%%%i
    if exist list.txt del list.txt
    call list ./ > NuL
    )

    cd %curpath%

    REM |-------------------------------------------------------|
    REM | Cleanup |

    FOR /F "tokens=1 delims=" %%i IN (oldpath.txt) DO set str=%%i

    set str=%str:~5%
    set path=%str%
    del oldpath.txt


    Echo Ok

    path.txt  -- List of subdirectories to create a list file in
    Code: [Select]
    Win7\x86\
    Sub\Folder\

    list.bat
    Code: [Select]
    @echo off

    dir /b /a:-d > temp.txt

    FOR /F "tokens=1" %%i in (temp.txt) do (
    IF "%%i"=="temp.txt" ( echo. ) ELSE (echo %~d1,%~p1,%%i >> list.txt)
    )
    del temp.txt

    rgammons



      Newbie

      • Experience: Beginner
      • OS: Unknown
      Re: Batch Programs Thread.
      « Reply #508 on: April 05, 2011, 05:21:32 PM »
      how do you write a batch file with no lables

      @ECHO OFF
      SET ANS=%1
      IF "%ANS%"=="" GOTO NOTHING
      IF /I "%ANS%"=="Y" GOTO YES
      IF /I "%ANS%"=="N" GOTO NO
      ECHO.
      ECHO INVALID ENTRY, PLEASE REENTER
      GOTO QUIT
      :NOTHING
      ECHO.
      Echo You Entered Nothing
      Echo Please Reenter
      GOTO QUIT
      :YES
      ECHO.
      Echo You Entered Yes
      Echo Whooppee - isn't this exciting!
      GOTO QUIT
      :NO
      ECHO.
      Echo You Entered NO
      Echo How Negative!
      :QUIT

      Salmon Trout

      • Guest
      Re: Batch Programs Thread.
      « Reply #509 on: April 08, 2011, 09:35:41 AM »
      how do you write a batch file with no lables

      In this case, by suitable use of multiline IF tests.

      I was going to tell you off for wrongly spelling "labels" but I found that when I was testing this file I consistently typed "lable"  in the folder and file names...


      Code: [Select]
      @ECHO OFF
      SET ANS=%1
      IF "%ANS%"=="" (
      ECHO.
      ECHO INVALID ENTRY, PLEASE REENTER
      ECHO.
      Echo You Entered Nothing
      Echo Please Reenter
      )
      IF /I "%ANS%"=="Y" (
      ECHO.
      Echo You Entered Yes
      Echo Whooppee - isn't this exciting!
      )
      IF /I "%ANS%"=="N" (
      ECHO.
      Echo You Entered NO
      Echo How Negative!
      )

      Code: [Select]
      C:\Batch\Test\no-labels>no-label.bat

      INVALID ENTRY, PLEASE REENTER

      You Entered Nothing
      Please Reenter

      C:\Batch\Test\no-labels>no-label.bat Y

      You Entered Yes
      Whooppee - isn't this exciting!

      C:\Batch\Test\no-labels>no-label.bat N

      You Entered NO
      How Negative!

      C:\Batch\Test\no-labels>no-label.bat e

      C:\Batch\Test\no-labels>


      Does the last test tell you anything?