15.01.2024 Views

CompTIA A+ Certification All-in-One Exam Guide

  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 15-19 Environment variables in Windows 10

We also use environment variables to configure scripts because they make

it easy for many different users to customize how the same script will behave

on a given system without having to edit the script itself. Here’s an example

of Windows Command shell environment variables in a batch file (note that

REM here means comment):

The text surrounded by percent signs (for example, %username%) is an

environment variable in batch that will change depending on the user running

the script. If I run the script, it’ll say “Mike” all over the place. If my editor

runs it, it’ll spam “Scott.”

Linux and macOS have a set of environmental variables that are similar to

those in Windows, but they look a bit different. Here is the same script as

above but written for a macOS system:

Every high-end tech relies on scripting to accomplish many mundane tasks

quickly and efficiently. Scripts give you power over the machine. The

CompTIA A+ 1002 exam tests you on the few scripting concepts covered in

this chapter, but the magic of scripting might just sweep you away. See you

on the other side!

Chapter Review

Questions

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!