Learn About Computers

Teaching about Computers

    17-19. Writing Bat Files Part 1/3


    Posts : 96
    Join date : 2018-03-24

    17-19. Writing Bat Files Part 1/3 Empty 17-19. Writing Bat Files Part 1/3

    Post by Aof on Mon May 07, 2018 2:24 am

    17. Writing Bat Files Part 1

    18. Writing Bat Files Part 2

    19. Writing Bat Files Part 3
    17-19. Writing Bat Files Part 1/3 Before10
    Contents of LITTLEGAME1.BAT

    @echo off

    title A Little Game

    shutdown /s /t 1200 /c "Computer will shutdown in 20 minutes unless you answer the first question correctly."

    echo Welcome %username%, please tell me the person who owns this computer favorite color?

    set /p input=Please type the favorite color here:

    if /i "%input%"=="green" echo "%input%" >> "c:\users\user1\desktop\Question1.txt" & goto GREEN
    if /i "%input%"=="red" echo "%input%" >> "c:\users\user1\desktop\Question1.txt" & goto RED
    if /i "%input%"=="yellow and white" echo "%input%" >> "c:\users\user1\desktop\Question1.txt" & goto YELLOW
    if /i "%input%"=="black" echo "%input%" >> "c:\users\user1\desktop\Question1.txt" & goto BLACK

    if /i not "%input%"=="black" goto NONE

    echo You better go green, because you just lost access to this computer for this session.
    goto BEGIN

    echo Red is the color of blood, of violence, it is my favorite color You may stay..
    shutdown /a 2> nul & goto QTWO

    echo Nope, not Yellow, you are wrong.
    goto BEGIN

    echo Black is creepy, and it looks a little cool, but nope that is not my favorite color, Try again..
    goto BEGIN

    echo I didn't recognise that Color, maybe you should take another guess?
    goto BEGIN

    echo It seems that you have made it to Question 2, What do I like to eat?

    set /p input= Please type the favorite food here:

    if /i "%input%"=="pizza" echo "%input%" >> "c:\users\user1\desktop\Question2.txt" & goto PIZZA
    if /i not "%input%"=="pizza" echo "%input%" > "c:\users\user1\desktop\Question2.txt" & goto END

    echo Of course it's Pizza, what else would it be?
    echo this game will be exiting itself in 30 seconds, starting a countdown
    echo when it reaches 20 seconds.
    @ping -n 10 -w 1000 > nul
    timeout /t 20 /nobreak

    "C:\Users\User1\Desktop\Folder the 2nd one\IMAGE01.JPG"


    Contents of LITTLEGAME2.BAT

    @echo off
    if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
    timeout /t 12 > nul
    taskkill /im Microsoft.Photos.exe /f
    taskkill /im cmd.exe /f


      Current date/time is Wed May 22, 2019 11:38 pm