Hello and welcome to the mainland.
This video we're going to learn
about Windows bad scripting.
I'm Christopher Heller.
And let's begin.
So we're learning objects for this
video. We're going to understand the
purpose of a bad script for Windows.
We're going to learn how to write a
bad script, and we are going to
execute a bad script as well.
Now, pretty assessment.
What is the well known file
extension for when there's bad
scripts? Is it A bad
B batch?
C, the VBS or
D Makram?
The answer is a dump, that this
is the Windows File extension for
batch scripts, and it helps Windows
file system identify which
program it should use to
automatically open and execute
this file.
But that batch is not a valid
extension.
The feebs macro
are different types of scripting
files for windows
and not for batch scripts.
So the purpose of Bache groups is
very similar to
the Linux Shell
scripts, where if we write a
whole bunch of commands that we
don't want to have to keep writing
out over and over again, we can
type them into a bad script and then
we can either double click the file
to have an execute force or execute
it directly in the terminal.
And we can have other processes
executed as well.
So say with the service control,
if we have a specific service
where we want it to execute
a specific command, if it fails,
we can use the best script that
we wrote, giving it specific
directions and commands to execute
and say, hey, if you fail, we're
in this bad script so
it can be executed by other
terminals or other processes.
And like we have the
bad extension.
So we write a bad script,
we have a few different
uses we can have,
we can have these labels which are
very useful in order to help
loop in a different way than the
other Windows loops that we learned.
So if we have these colan
for a label, it creates a specific
section in the script for us.
And then later on in the script, if
we say, hey, I want you to go to
this label, it will go back to that
specific spot.
So as we see
excuse me, let
me get my pen.
So as we see, we put the colon
and start here.
So this created the label for start.
Now it'll echo.
Hello.
That is the next command and the
command. After that, it says, hey,
you need to go to start.
And that will send it right back up
to the start.
And then we'll keep executing down
and we'll say, All right, I need to
echo hello and says, all right,
I need to go to start and we'll just
keep looping in this way.
So it's a very useful way to be able
to loop inside of a batch
file.
So I'll give you a quick
demonstration of that, my text
file folder to see
what is inside.
And let's say I have the loop.
Not that now I'm going to
type them, looped up that to
see what's inside.
And this is the same file we were
looking at in the PowerPoint
presentation.
It's going to start akolo and
then go back to start.
Now, what's a little different in
Windows is that we don't need to
do the dot forward slash.
We can just type the name of the
batch file enter
and it is going nuts.
So I'm going to do control see
and say, yes, I want to terminate
this bad job because I don't want to
keep looping forever and ever.
So we can also get very creative
with the batch files and the Linux
Shell files.
And if you haven't learned already
the color command it'll use,
it will change the foreground and
the text color of the command
window. So if we say,
hey, I want you to keep changing
the color of the background and
keep changing the color of the text
and then go back up to
the start.
So this is very similar to our last
one. Keep changing the colors.
Now, I'm going to run this command.
And if you don't like a lot
of bright flashing colors,
then I suggest you go ahead and
skip forward about 30 seconds.
So let's see. I have the colors
that that I'm going to execute this
and it is going absolutely nuts.
So I'm going to terminate that and
say we're done.
But that's a very useful way to kind
of loop through and get creative
with what we're doing with the batch
files.
So Mexican bad scripts, as we've
already learned, we can type the
file names directly into the command
prompt so we can do just colors,
not that like we just did.
Now you need to be in the same
directory as the file you're going
to execute.
If you are not in the same
directory, then you will either need
to type the full folder structure,
the absolute path for that file.
So that is a another way
to stay inside the same working
directory you're in, but also access
that file in a different
directory.
It's a post assessment.
How do you create labels in the
script? Is it a semicolon,
B colon, C
parentheses or D
forward slash?
The answer is B a coin.
This creates the label that we can
use to go to command in order to
keep looping or create different
functionality inside of that script.
So it's very useful to keep this in
mind while you're writing these vast
groups in order to be able to become
effective at what you're doing.
So in this video, we learned we
understood the purpose of a bad
script. We learned how to write a
bad script, and we executed
a script from the command line.
And I hope to see you in the next
50.