Command @
Description Do not echo this line.
Syntax @ command line
Typical Use To hide a single line if echo is switched on, or to hide the switching off of the echo command.
Examlpe echo This line will be echoed twice to the screen,
@echo Whereas this line will occur only once.
Command ECHO
Description The ECHO command has several different uses. MS DOS batch files use two echo 'modes'. The default echo mode is ECHO ON. When ECHO is set to ON, every command in the batch file is displayed to the screen before it is run. Sometimes this information is not required, and can even be downright annoying for larger batch files. The command ECHO OFF sets the batch echo mode to OFF. In this mode, the commands are not printed to the screen prior to their execution.
As well as the echo modes, the ECHO command is used to print a message to the user. Messages are displayed to the user by preceding a line of text with ECHO.
Syntax ECHO MODE ON : ECHO ON
ECHO MODE OFF : ECHO OFF
DISPLAY A MESSAGE : ECHO message
Typical Use The command @ECHO OFF is almost always placed at the top of a batch file to switch off subsequent command echo.
ECHO is also the only way a batch file can communicate information to a user.
Example @ECHO OFF
ECHO Please insert a disk in drive A: and press any key when ready.
Command REM (short for remark)
Description REM is the MS DOS batch file method of providing comments. Comments are lines of code which are not executed by the batch file, but rather are used to convey information about the workings of the batch file itself. Good batch file programming practice demands a comment at the head of every batch file explaining its use and syntax. Comments can also be put in other parts of the file to clarify ambiguous commands and to 'comment-out' a line of commands so that they are temporarily ignored by the batch file.
Syntax REM line containing comment.
Typical Use REM should be used at the top of every batch file to provide a description and example use. However, too many REM lines are not an example of good programming style! Don't provide a comment for obvious commands - only the tricky ones!
Example REM SFORMAT.BAT : Safe Format
REM
REM This batch file implements a safe version of the format command.
REM The C: drive can not be formatted with this command.
Command PAUSE
Description The PAUSE command prints the message "Press any key to continue..." to the screen and waits for the user to respond.
Syntax PAUSE (it's as simple as that!)
Typical Use The PAUSE command was the only method of getting a user's response in batch files until the choice command arrived in MS DOS 6.x. By issuing instructions with the ECHO command, the PAUSE command waited for the user to read them and respond appropriately.
Example ECHO Please insert the disk in drive A: and
PAUSE
Command GOTO
Description The GOTO command allows a batch file to branch to a different location to continue executing commands from. To tell the batch file where to go to, a label is placed after the GOTO command. This label must conform to several guidelines for it to be a valid batch file label.
Syntax GOTO label
Typical Use Until MS DOS 6.x introduced the FOR command, the GOTO command was a batch files only mechanism of performing a command repeatedly. GOTOs are still the only method in a batch file to perform a sub-set of commands. (MS DOS Batch files do not have sub-procedures)
Example IF %1 == "" GOTO ERROR
Command IF
Description The IF command is used in batch files to test whether a condition is met or not. This allows the batch file to perform a particular action only if a particular condition is met. There are several different variations of the IF command: IF EXIST, IF ERRORLEVEL, and IF x == y (yes! it does use two equal signs!)
Syntax IF EXIST filename or dirname : used to test for the existance of a file or directory in MS DOS. This test will return true if the file does exist.
IF ERRORLEVEL : After a program has finished executing in MS DOS it returns a value to the operating system indicating its success or failure. This value is stored in the variable ERRORLEVEL. By testing this variable, a batch file can deduce the result of the program that just finished running.
IF x == y : This version of the IF statement tests two string values. If string x is equal to string y this test is evaluated to be true, otherwise false.
All of the above IF statements can also be negated with the NOT command. For example -:
IF NOT EXIST filename : Tests to see if the file doesn't exist. This test will return true if the file doesn't exist.
Typical Use The IF statement is one of the most useful batch file commands, and as such is probably the most common. The IF EXIST command is used to check if a file exists before it is copied/moved/opened/etc. The IF ERRORLEVEL allows a batch file to check the return value of another program. The IF STRING1 == STRING2 is commonly used to validate command-line parameters.
Example IF NOT EXIST %1 MKDIR %1
IF ERRORLEVEL 2 GOTO END
IF %1 == "" GOTO ERROR
Command SHIFT
Description The SHIFT command is possibly, at first, the most confusing batch file command. It needn't be. Simply, the SHIFT command increases the number of command-line parameters accessable by a batch file. Each time SHIFT is called, the value in the 1st parameter is discarded and replaced by the value of the 2nd parameter. The value in the 2nd parameter is replaced by the value in the 3rd parameter, etcetera, etcetera, until the 9th parameter is replaced by the previously unavailable 10th parameter.
Syntax SHIFT
Typical Use The SHIFT command provides considerable power to batch files. It allows a batch file to operate on an unknown number of parameters. The SHIFT command is often used in situations where an operation needs to be performed on several files or directories.
Example The following example displays the contents of the files typed after the batch file name one page at a time.
:LOOP
TYPE %1 MORE
SHIFT
IF "%1" == "" GOTO END
GOTO LOOP
:END
Command CALL
Description The CALL command is used to run another batch file from within a batch file. Execution of the current batch file is paused and the called batch file is run. After the called batch file has finished running, the original batch file is resumed at the line after the CALL statement.
Note: If another batch file is run from within a batch file by simply using its name, after the called batch file finishes executing, control is returned to the Command Line, NOT the original batch file.
Syntax CALL batchfilename [parameters] [switches]
Typical Use The CALL command is used to provide modularity to batch files. Batch files can be re-used effortlessly if they are written with modularity in mind.
Example IF %1 == A: CALL FLOPPY.BAT
Command FOR
Description The FOR command was an invaluable addition to the DOS Batch File Command suite. FOR repeats a command for a number of files, directories, or text-strings.
Syntax FOR variable IN list DO command [parameters] [switches]
Where -:
variable is substituted for each element in the list and passed to command. Variable has a special format in batch files.
list is a list of filenames (wildcards allowed), directory names, or text-strings that are to be processed by command one at a time.
command is a DOS internal or external command to be performed for each element of the list.
Typical Use The FOR command performs the same command for each element of a list. Prior to its introduction, the same effect had to be achieved with GOTOs and IFs, which were messy and sometimes difficult to follow. Use a FOR to do any necessary looping in your batch files.
Example The following is an implementation of the same example presented in the SHIFT example of displaying many files to the screen with MORE.
FOR %%f IN (*.*) DO TYPE %%f MORE
A lot neater, huh?!
Command CHOICE
Description The CHOICE command is perhaps the best addition to MS DOS Batch File commands. CHOICE makes it possible to accept various user-responses. Before now, users were presented with crude either/or choices in batch files. The CHOICE command allows a batch file to detect a users choice from a lits of options.
Syntax CHOICE [/C:choices] [/N] [/S] [/T:choice,timeout] [TEXT]
Where -:
/C:choices : specifies the choices that the user can choose from. The choices can only be single characters.
/N : Do not display choices and the '?' at the end of the TEXT prompt.
/S : Treat the choices as case sensitive, meaning that 'a' is a different choice from 'A'. By default, case is not sensitive - 'a' is equivalent to 'A'.
/T:choice,timeout : Default to choice after timeout seconds.
TEXT : The text to display as the prompt of the choice.
Typical Use The CHOICE command has its obvious use in batch files. It is now possible to easily get a users response, thus allowing batch files to be much more interactive, and therefore more useful.
Example The following batch file snippet displays a simple menu (without a question-mark at the end of the prompt) and prompts for the users choice, defaulting to option 2 after 5 seconds :
ECHO 1. MS-DOS Editor.
ECHO 2. MS-Windows. (default)
ECHO 3. Defrag the hard-drive.
ECHO 4. Quit.
CHOICE /C:1234 /N /T:2,5 Please choose a menu option.
IF ERRORLEVEL == 4 GOTO QUIT_MENU
IF ERRORLEVEL == 3 GOTO DEFRAG_HD
IF ERRORLEVEL == 2 GOTO RUN_WIN
IF ERRORLEVEL == 1 GOTO RUN_EDIT
:RUN_EDIT
CALL EDIT
:RUN_WIN
CALL WIN
:DEFRAG_HD
DEFRAG c:
:QUIT_MENU
ECHO Safe to switch off machine now...
Search my blog articles
Tuesday, May 23, 2006
Wednesday, May 17, 2006
90/10 Principle
The 90/10 Principle
Author : Stephen Covey ( Management Guru)
Have you read this before? Discover the 90/10 Principle. It will change your
life
(at least the way you react to situations). What is this principle?
10% of life is made up of what happens to you. 90% of life is decided by how you react .
What does this mean?
We really have no control over 10% of what happens to us. We cannot stop the
car from breaking down. The plane will be late arriving, which throws our
whole schedule off. A driver may cut us off in traffic. We have no control
over this 10%. The other 90% is different. You determine the other 90%.
How? By your reaction. You cannot control a red light., but you can control
your reaction. Don't let people fool you; YOU can control how you react.
Let's use an example. You are eating breakfast with your family. Your
daughter knocks over a cup of coffee onto your business shirt. You have no
control over what just what happened. What happens when the next will be
determined by how you react.You curse. You harshly scold your daughter for
knocking the cup over.
She breaks down in tears. After scolding her, you turn to your spouse and
criticize her for placing the cup too close to the edge of the table. A
short verbal battle follows. You storm upstairs and change your shirt. Back
downstairs, you find your daughter has been too busy crying to finish
breakfast and get ready for school. She misses the bus. Your spouse must
leave immediately for work.
You rush to the car and drive your daughter to school. Because you are late,
you drive 40 miles an hour in a 30 mph speed limit. After a 15-minute delay
and throwing $60 traffic fine away, you arrive at school. Your daughter runs
into the building without saying goodbye. After arriving at the office 20
minutes late, you find you forgot your briefcase. Your day has started
terrible. As it continues, it seems to get worse and worse. You look forward
to coming home, When you arrive home, you find small wedge in your
relationship with your spouse and daughter.
Why? Because of how you reacted in the morning. Why did you have a bad day?
A) Did the coffee cause it?
B) Did your daughter cause it?
C) Did the policeman cause it?
D) Did you cause it?
The answer is " D".
You had no control over what happened with the coffee. How you reacted in
those 5 seconds is what caused your bad day. Here is what could have and
should have happened.
Coffee splashes over you. Your daughter is about to cry. You gently say,
"It's ok honey, you just need, to be more careful next time". Grabbing a
towel you rush upstairs. After grabbing a new shirt and your briefcase, you come back down in time to look through the window and see your child getting on the bus.
She turns and waves. You arrive 5 minutes early and cheerfully greet the
staff. Your boss comments on how good the day you are having.
Notice the difference? Two different scenarios. Both started the same. Both
ended different.
Why? Because of how you REACTED. You really do not have any control over 10%
of what happens. The other 90% was determined by your reaction.
Here are some ways to apply the 90/10 principle. If someone says something
negative about you, don't be a sponge. Let the attack roll off like water on
glass. You don't have to let the negative comment affect you! React properly
and it will not ruin your day. A wrong reaction could result in losing a
friend, being fired, getting stressed out etc.
How do you react if someone cuts you off in traffic? Do you lose your
temper? Pound on the steering wheel? A friend of mine had the steering wheel
fall off) Do you curse? Does your blood pressure skyrocket? Do you try and bump them? WHO CARES if you arrive ten seconds later at work? Why let the cars ruin your drive? Remember the 90/10 principle, and do not worry about it.
You are told you lost your job. Why lose sleep and get irritated? It will
work out. Use your worrying energy and time into finding another job. The
plane is late; it is going to mangle your schedule for the day. Why take out
your frustration on the flight attendant? She has no control over what is
going on. Use your time to study, get to know the other passenger. Why get
stressed out? It will just make things worse. Now you know the 90-10
principle. Apply it and you will be amazed at the results. You will lose
nothing if you try it.
The 90-10 principle is incredible. Very few know and apply this principle.
The result? Millions of people are suffering from undeserved stress, trials,
problems and heartache. We all must understand and apply the 90/10
principle.
It CAN change your life!!!
Author : Stephen Covey ( Management Guru)
Have you read this before? Discover the 90/10 Principle. It will change your
life
(at least the way you react to situations). What is this principle?
10% of life is made up of what happens to you. 90% of life is decided by how you react .
What does this mean?
We really have no control over 10% of what happens to us. We cannot stop the
car from breaking down. The plane will be late arriving, which throws our
whole schedule off. A driver may cut us off in traffic. We have no control
over this 10%. The other 90% is different. You determine the other 90%.
How? By your reaction. You cannot control a red light., but you can control
your reaction. Don't let people fool you; YOU can control how you react.
Let's use an example. You are eating breakfast with your family. Your
daughter knocks over a cup of coffee onto your business shirt. You have no
control over what just what happened. What happens when the next will be
determined by how you react.You curse. You harshly scold your daughter for
knocking the cup over.
She breaks down in tears. After scolding her, you turn to your spouse and
criticize her for placing the cup too close to the edge of the table. A
short verbal battle follows. You storm upstairs and change your shirt. Back
downstairs, you find your daughter has been too busy crying to finish
breakfast and get ready for school. She misses the bus. Your spouse must
leave immediately for work.
You rush to the car and drive your daughter to school. Because you are late,
you drive 40 miles an hour in a 30 mph speed limit. After a 15-minute delay
and throwing $60 traffic fine away, you arrive at school. Your daughter runs
into the building without saying goodbye. After arriving at the office 20
minutes late, you find you forgot your briefcase. Your day has started
terrible. As it continues, it seems to get worse and worse. You look forward
to coming home, When you arrive home, you find small wedge in your
relationship with your spouse and daughter.
Why? Because of how you reacted in the morning. Why did you have a bad day?
A) Did the coffee cause it?
B) Did your daughter cause it?
C) Did the policeman cause it?
D) Did you cause it?
The answer is " D".
You had no control over what happened with the coffee. How you reacted in
those 5 seconds is what caused your bad day. Here is what could have and
should have happened.
Coffee splashes over you. Your daughter is about to cry. You gently say,
"It's ok honey, you just need, to be more careful next time". Grabbing a
towel you rush upstairs. After grabbing a new shirt and your briefcase, you come back down in time to look through the window and see your child getting on the bus.
She turns and waves. You arrive 5 minutes early and cheerfully greet the
staff. Your boss comments on how good the day you are having.
Notice the difference? Two different scenarios. Both started the same. Both
ended different.
Why? Because of how you REACTED. You really do not have any control over 10%
of what happens. The other 90% was determined by your reaction.
Here are some ways to apply the 90/10 principle. If someone says something
negative about you, don't be a sponge. Let the attack roll off like water on
glass. You don't have to let the negative comment affect you! React properly
and it will not ruin your day. A wrong reaction could result in losing a
friend, being fired, getting stressed out etc.
How do you react if someone cuts you off in traffic? Do you lose your
temper? Pound on the steering wheel? A friend of mine had the steering wheel
fall off) Do you curse? Does your blood pressure skyrocket? Do you try and bump them? WHO CARES if you arrive ten seconds later at work? Why let the cars ruin your drive? Remember the 90/10 principle, and do not worry about it.
You are told you lost your job. Why lose sleep and get irritated? It will
work out. Use your worrying energy and time into finding another job. The
plane is late; it is going to mangle your schedule for the day. Why take out
your frustration on the flight attendant? She has no control over what is
going on. Use your time to study, get to know the other passenger. Why get
stressed out? It will just make things worse. Now you know the 90-10
principle. Apply it and you will be amazed at the results. You will lose
nothing if you try it.
The 90-10 principle is incredible. Very few know and apply this principle.
The result? Millions of people are suffering from undeserved stress, trials,
problems and heartache. We all must understand and apply the 90/10
principle.
It CAN change your life!!!
Thursday, May 11, 2006
Wednesday, May 03, 2006
Ab Workout for guys
Article from MSN, just want to share the good article found at.
http://health.msn.com/fitness/articlepage.aspx?cp-documentid=100123672
The workout
This routine attacks your midsection from every angle, so your abs are constantly challenged. Choose one exercise from each section, for a total of five. Perform one move immediately after the other for the specified number of repetitions, then repeat the circuit. After four weeks, choose the exercise in each group that you didn't perform in your previous workouts. This ensures that your muscles are always adapting to new stress.
Burn Off Your Belly
This interval routine is designed to strip away the excess flab that's hiding your six-pack. Do it three days a week, after your weight session or on the days in between. Use your mode of choice-a treadmill, stationary bike or rowing machine.
Step 1: Warm up for three to five minutes at an easy pace, about 30 to 40 percent of your best effort.
Step 2: Run, cycle or row at 95 percent of your highest effort for 30 seconds.
Step 3: Perform active rest, slowing back down to your warmup speed for 90 seconds.
Step 4: Repeat five to seven times.
Step 5: Once you can complete eight intervals, reduce the length of your active rest periods by five to 10 seconds each workout, until they're only 30 seconds long.
Section 1
Standing Cable Crunch
Attach a rope to a high-pulley cable. Stand with your back to the weight stack and hold one end of the rope on the left side of your head and the other end on the right. Crunch your torso down. Pause, then return to the starting position. Do 10 to 15 repetitions.
Weighted Crunch
Lie on your back with your knees bent, and hold a weight plate or dumbbell on your chest. (If that's too hard, just do a traditional crunch.) Slowly crunch up, bringing your shoulder blades off the floor. Pause, then lower yourself to the starting position. Do 10 to 15 repetitions.
Section 2
Pulse-up
Lie with your hands under your tailbone and your legs extended straight up toward the ceiling, perpendicular to your torso. Lift your hips off the floor in a straight line. Pause, then lower your hips. Do 10 to 15 repetitions.
Figure-8 Crunch
Lie on your back with your knees bent at a 90-degree angle, squeezing a light medicine ball tightly between them, and place your feet flat on the floor. Place your fingers behind your ears, then slowly raise your head, shoulders and feet off the floor. Keeping your torso up, move your knees in a figure-8 motion. Each figure-8 is one repetition. Do 10 to 15 repetitions.
Section 3
Medicine-Ball Torso Rotation
Hold a medicine ball or basketball in front of you as you kneel and sit back on your heels. Quickly twist to your left and set the ball down behind your back. Twist to the right and pick up the ball, then bring it around to your left and set it down again. That's one repetition. Do 10 to 15 repetitions.
Side Jackknife
Lie on your left side, with your legs nearly straight and slightly raised off the floor. Also, lift your torso off the floor, with your left forearm on the floor for balance. Hold your other hand behind your right ear, with your elbow pointed toward your feet. Lift your legs toward your torso while keeping your torso stationary. Pause to feel the contraction on the right side of your waist. Then slowly lower your legs and repeat. Finish the set, then switch sides. Do 10 to 15 repetitions.
Section 4
Two-Point Bridge
Assume the standard pushup position. Lift your right arm and left leg off the floor at the same time. Hold for three to five seconds, then lower them. That's one repetition. Return to the starting position, then repeat, lifting your left arm and right leg this time. Do 10 to 15 repetitions.
Negative Crunch
Sit with your knees bent and your feet flat on the floor, shoulder-width apart. (Tuck your feet under weights to maintain balance.) Extend your arms in front of you with your fingers interlaced. Begin with your upper body at slightly less than a 90-degree angle to the floor. Lower your upper body toward the floor, curling your torso forward, rounding your lower back, and keeping your abs contracted. When your upper body reaches a 45-degree angle to the floor, return to the starting position. Do 10 to 15 repetitions.
Section 5
Back Extension
Position yourself in a back-extension station, and hook your feet under the leg anchor. Hold your arms straight out beyond your head. Lower your torso, allowing your lower back to round slightly, until it's just short of perpendicular to the floor. Pause, then raise your upper body until it's slightly above parallel to the floor. At this point, you should have a slight arch in your back, and your shoulder blades should be pulled together. Do 10 to 15 repetitions.
Twisting Back Extension
Position yourself in a back-extension station, and hook your feet under the leg anchor. Lace your hands behind your head. Lower your torso, allowing your lower back to round slightly, until it's just short of perpendicular to the floor. Raise and twist your upper body until it's in line with your hips and facing right. That's one repetition. Repeat the move, this time twisting to your left. Do 10 to 15 repetitions.
http://health.msn.com/fitness/articlepage.aspx?cp-documentid=100123672
The workout
This routine attacks your midsection from every angle, so your abs are constantly challenged. Choose one exercise from each section, for a total of five. Perform one move immediately after the other for the specified number of repetitions, then repeat the circuit. After four weeks, choose the exercise in each group that you didn't perform in your previous workouts. This ensures that your muscles are always adapting to new stress.
Burn Off Your Belly
This interval routine is designed to strip away the excess flab that's hiding your six-pack. Do it three days a week, after your weight session or on the days in between. Use your mode of choice-a treadmill, stationary bike or rowing machine.
Step 1: Warm up for three to five minutes at an easy pace, about 30 to 40 percent of your best effort.
Step 2: Run, cycle or row at 95 percent of your highest effort for 30 seconds.
Step 3: Perform active rest, slowing back down to your warmup speed for 90 seconds.
Step 4: Repeat five to seven times.
Step 5: Once you can complete eight intervals, reduce the length of your active rest periods by five to 10 seconds each workout, until they're only 30 seconds long.
Section 1
Standing Cable Crunch
Attach a rope to a high-pulley cable. Stand with your back to the weight stack and hold one end of the rope on the left side of your head and the other end on the right. Crunch your torso down. Pause, then return to the starting position. Do 10 to 15 repetitions.
Weighted Crunch
Lie on your back with your knees bent, and hold a weight plate or dumbbell on your chest. (If that's too hard, just do a traditional crunch.) Slowly crunch up, bringing your shoulder blades off the floor. Pause, then lower yourself to the starting position. Do 10 to 15 repetitions.
Section 2
Pulse-up
Lie with your hands under your tailbone and your legs extended straight up toward the ceiling, perpendicular to your torso. Lift your hips off the floor in a straight line. Pause, then lower your hips. Do 10 to 15 repetitions.
Figure-8 Crunch
Lie on your back with your knees bent at a 90-degree angle, squeezing a light medicine ball tightly between them, and place your feet flat on the floor. Place your fingers behind your ears, then slowly raise your head, shoulders and feet off the floor. Keeping your torso up, move your knees in a figure-8 motion. Each figure-8 is one repetition. Do 10 to 15 repetitions.
Section 3
Medicine-Ball Torso Rotation
Hold a medicine ball or basketball in front of you as you kneel and sit back on your heels. Quickly twist to your left and set the ball down behind your back. Twist to the right and pick up the ball, then bring it around to your left and set it down again. That's one repetition. Do 10 to 15 repetitions.
Side Jackknife
Lie on your left side, with your legs nearly straight and slightly raised off the floor. Also, lift your torso off the floor, with your left forearm on the floor for balance. Hold your other hand behind your right ear, with your elbow pointed toward your feet. Lift your legs toward your torso while keeping your torso stationary. Pause to feel the contraction on the right side of your waist. Then slowly lower your legs and repeat. Finish the set, then switch sides. Do 10 to 15 repetitions.
Section 4
Two-Point Bridge
Assume the standard pushup position. Lift your right arm and left leg off the floor at the same time. Hold for three to five seconds, then lower them. That's one repetition. Return to the starting position, then repeat, lifting your left arm and right leg this time. Do 10 to 15 repetitions.
Negative Crunch
Sit with your knees bent and your feet flat on the floor, shoulder-width apart. (Tuck your feet under weights to maintain balance.) Extend your arms in front of you with your fingers interlaced. Begin with your upper body at slightly less than a 90-degree angle to the floor. Lower your upper body toward the floor, curling your torso forward, rounding your lower back, and keeping your abs contracted. When your upper body reaches a 45-degree angle to the floor, return to the starting position. Do 10 to 15 repetitions.
Section 5
Back Extension
Position yourself in a back-extension station, and hook your feet under the leg anchor. Hold your arms straight out beyond your head. Lower your torso, allowing your lower back to round slightly, until it's just short of perpendicular to the floor. Pause, then raise your upper body until it's slightly above parallel to the floor. At this point, you should have a slight arch in your back, and your shoulder blades should be pulled together. Do 10 to 15 repetitions.
Twisting Back Extension
Position yourself in a back-extension station, and hook your feet under the leg anchor. Lace your hands behind your head. Lower your torso, allowing your lower back to round slightly, until it's just short of perpendicular to the floor. Raise and twist your upper body until it's in line with your hips and facing right. That's one repetition. Repeat the move, this time twisting to your left. Do 10 to 15 repetitions.
Subscribe to:
Posts (Atom)