![]() |
|
Beginner Vocabulary #1 - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: Beginner Vocabulary #1 (/Thread-Beginner-Vocabulary-1) |
Beginner Vocabulary #1 - Emerald - 01-24-2014 Note: @echo off stops the extra command prompt information from showing.
also ignore the parentheses in the first two. They are just to show specifically what is happening from which code. To create a batch program, simply open Notepad.exe, and when you go to save save as ____.bat, under "All Files." Vocabulary: echo The main output for strings(phrases of text). This is to give the person running the program some idea of what they are required to do or to give them information. Example Code: Code: @Echo off
Echo Welcome to my program.
echo.
pauseAlternate Use: "Echo." can be used to divide lines with a space. Result: Code: ((Welcome to my program.))
Press any key to continue...pause Tells the program to wait for user to input a key stroke. Example Code: Code: @Echo off
Echo Welcome to my program.
echo.
pauseResult: Code: Welcome to my program.
((Press any key to continue...))goto Causes the code to jump to its denoted marker. In this situation, it moves from the start, to variable "a", to variable "c." For example if you were to write "goto loop", you must declare a marker named "loop". This can be done by simply writing it by itself on a line with a semi colon in front. Example Code: Code: :b
Hello!
pause
goto a
:c
cls
echo Hello again!
pause
cls
:a
echo 13
pause
goto cResult: Code: Hello!
Press any key to continue...Code: 13
Press any key to continue...Code: Hello again!
Press any key to continue...cls Clears the screen of all writing. Example Code: Code: @echo off
echo Hello.
pause
cls
echo How're you?
pauseResult: Code: Hello.
Press any key to continue...Code: How're you?
Press any key to continue...start Can be used to open programs, or even open webpages. Example Code: Code: @echo off
start www.yahoo.ca
start firefox.exe
pauseResult: *Opens yahoo.ca on default browser* *Opens firefox browser* Any questions, feel free to PM me. I'll be writing a part two this weekend. RE: Beginner Vocabulary #1 - Fallen - 01-25-2014 Thanks for throwing in these vocab terms. Really should pick up in my batch scripts again. RE: Beginner Vocabulary #1 - 0xDEAD10CC - 02-23-2014 As with 'echo.' you can also use 'echo\' just as a mention. You also don't require 'start' to execute a program, although the result of using 'start' and not using it is slightly different at execution time. |