Batch-101 Flashcards

1
Q

What are the types of Commands we have in Batch?

A

Internal : DIR, COPY, DEL

External: Format, Undelete, Backup

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

Which keyword to use for comment

A

REM

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

Which command to use forEcho

A

ECHO

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

How can we made the echo off

A

ECHO OFF

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

How can we prevent a particular command to still be shown but get executed

A

USe @ before the keyword

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

How can we pause for user reaction?

A

Do ECHO Warning: Statement PAUSE

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

What REM command does?

A

It will delete *.doc file in the folder

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

What does autoexec,bat does?

A

It gets executed every time the windows starts, it takes data from Path variable and run the commancd accordingly

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

How to capture the param from the command line?

A

Use %1, %2 and keep the counting with the no of params passed

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

Which command is used to comeout to windows back?

A

EXIT

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

So java, mongo and the like has batch utility to run and execute?

A

Exactly

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

What is the command for For Loop

A

FOR %%A in (items) DO …

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

Can we have %%[0-9] IN (items) DO…

A

NO only letters

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

What is the syntax for IF

A

IF [NOT] EXIST (ECHO…)

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

Can we Goto commancd

A

Yes, IF EXISTS C:/text.txt GOTO ME GOTO END

:ME ECHO ME End

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

Can we use IF back to back

A

Yes, IF EXIST C:/test.txt IF EXIST C:/ME.txt ECHO BOTH EXISTS

17
Q

What is NULL device

A

Each directory ahs null exists , which is unreadeable

18
Q

How can you check the existence of a folder?

A

IF EXIST c:/WINDOWS/nul ECHO Windows folder exists

19
Q

How can we check if a drive is valid?

A

IF EXIST c:/io.sys

20
Q

How can we compare the Strings?

A

IF [NOT] string1 == string2 Command

21
Q

What is sysntax for CHOICE?

A

CHOICE[string][/C:keys][/S][/N][/T:key;secs]
String : That you want display as comment
kEys: The char choices to be given
/S is to make them case insenstive
/N is to show the possible keys in bracket
/T:key;secs: key the o choose by defaultafter the secs (seconds) went out

22
Q

WHAT is CHOICE/C :AN12

A

The error level for A is 1 and for N it is 2, if 1 is pressed error level 3 and 2 is pressed error level is 4

23
Q

Can we use Errorlevels ?

A

Yes if command coupled with ErrorLevelis kewl

IF ERRORLEVEL 1 ECHO ….(for all > = 1)

24
Q

What is > &&raquo_space; does ?

A

One is to write and other is to append

25
Q

What is > NUL?

A

To suppress the message to nothing

26
Q

What is MORE and TYPE?

A

Type will shopw all the contents of the file, More will show part by part

27
Q

What is the pipe command?

A

To feed the output of one command to another

28
Q

Do we have TIME command?

A

Yes TIME

29
Q

How we can start the folder?

A

Path START .