Windows Command Line Flashcards

1
Q

What is located here?

C:\Windows\system32\cmd.exe

A

The windows command line

aka: cmd.exe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what does this do?

aa > file.txt
bb&raquo_space; file.txt
type file.txt

A

write and create
write and append
read

“aa
bb”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is the difference?

command1 & command2
command1 && command2

A
  1. execute both regardless of success

2. execute the later only if the former is sucessful

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is the difference?

command1 & command2
command1 && command2

A
  1. execute both regardless of success

2. execute the later only if the former is successful

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is the difference?

command1 & command2
command1 && command2

A
  1. execute both regardless of success

2. execute the later only if the former is successful

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is the difference?

command1 | command2
command1 || command2

A
  1. send output from first command to second command

2. if command1 fails execute command2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what file extension is used for Windows command line scripts?

A

.bat

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does the following mean?
SET x=qwe

if %x%==qwe (echo true)

if %x%==xyz (echo true)

if %x%==xyz (echo true) else (echo “does not contain xyz”)

A

these are windows comparison operators:

  1. sets the variable
  2. returns true
  3. returns nothing
  4. returns “does not contain xyz”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what does the following mean?
SET x=qwe

if %x%==qwe (echo true)

if %x%==xyz (echo true)

if %x%==xyz (echo true) else (echo “does not contain xyz”)

A

these are windows comparison operators:

  1. sets the variable
  2. returns true
  3. returns nothing
  4. returns “does not contain xyz”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the following do?

for %i in (.) do @echo FILE: %i

A

a for loop that lists files in a directory

”@” means to hide the prompt and just display the output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly