Home / Microsoft / Microsoft DOS / What's the point of remarks?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3  All - (Bottom) Print
Author Topic: What's the point of remarks?  (Read 4689 times)
BatchRocks
Topic Starter
Hopeful



Thanked: 3
Posts: 326




« on: January 15, 2009, 12:44:07 PM »

Hello!

What's the point of remarks as I see no use in them?

Is it just like if someone is editing, it tells what it is? I don't know, please help :O.

BR
IP logged
Dias de verano
Guest
« Reply #1 on: January 15, 2009, 01:17:58 PM »

I agree that if you are writing little toy batch scripts to play around with, that nobody else will ever see, it may be hard to see the usefulness of remarks. However, professional programmers especially those who work as part of a team, and people writing code to teach or help others often see remarks as a good thing.  Remarks help both you and other programmers who might modify and update your code in the future. Remarks offer descriptive messages that explain in English (or whatever language you prefer) what's going on in the program's code.

IP logged
BatchRocks
Topic Starter
Hopeful



Thanked: 3
Posts: 326




« Reply #2 on: January 15, 2009, 01:43:13 PM »

Oh, I see. Thanks. So, it's like if it's a team project, Team member A is like:

Rem ************Team  A************

ect.

Cool. Thanks. And thanks for not insulting me this time >.<  >:(
IP logged
Helpmeh
Egghead



Thanked: 117
Posts: 3,608

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #3 on: January 17, 2009, 07:36:54 AM »

I remember reading somewhere on CH about how too many remarks will actually lagg the script, but if you do

::Your Remark Here

it completely skips the line. Remark gets read through, but not executed...
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Dias de verano
Guest
« Reply #4 on: January 17, 2009, 07:40:01 AM »

I remember reading somewhere on CH about how too many remarks will actually lagg the script, but if you do

::Your Remark Here

it completely skips the line. Remark gets read through, but not executed...

Unless your machine is something like a 1995 Pentium 100 MHz, you won't notice any speed difference, and even then it would be very small. People who want speed don't use batch files.

IP logged
Helpmeh
Egghead



Thanked: 117
Posts: 3,608

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #5 on: January 17, 2009, 07:45:56 AM »

I was just repeating what I read...and I've managed to make my computer lagg so much to the point of crashing using too many rems...(that was on purpose though).

Edit: Found the post explaining the :: thing. Here's the quote.

When you start talking with us "old-schoolers" you will hear some funny stories.

I was working for ITT Servcom in the early 80's and I was in a bank presidents office one day when I noticed a bright colored DOS menu on his computer screen.
I asked "How do you do that" and for the next hour, I sat there getting my first formal training in DOS batch file and menu creation, from a Bank President.

A practical use of the @ sign would be to blank out just one line, in a batch file where all the other lines are being echoed to the screen.

When you start a batch file with Echo OFF, you put the @ sign at the start of the line so the command Echo Off won't be echo'ed to the screen.

I was taught to put:
@Echo Off
cls


at the beginning of every batch file.  I do that to this very day.
It clears the screen ( CLS ) and keeps it clean while the batch file runs, unless you instruct it to echo certain lines to the screen.

For batch file testing, you may want to disable the @Echo Off command during the testing procedure.  Then you can see if there are any error messages to your commands.

To disable any line, just put two colons (  ::  ) at the beginning of the line and DOS will totally ignore that line.  If you use REM, then DOS will continue to read the entire line, even though it will not (usually) execute it.  There are a few instances where the line or part of it MAY be executed, that's why I never use REM, but always the double colon.  Now it's just a habit.

Also, the batch file runs faster if DOS doesn't have to read the remark lines.

Cheers Mates, keep up the good work!

The Shadow  8)
« Last Edit: January 17, 2009, 07:57:51 AM by Helpmeh » IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Dias de verano
Guest
« Reply #6 on: January 17, 2009, 08:04:52 AM »

I don't think this person is an expert, the advice about using :: instead of REM is a mistake, as I pointed out later in that thread.
IP logged
macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #7 on: January 17, 2009, 09:23:56 AM »

and remarks are also good for pointing out bugs in some parts of code that you can debugged later on.
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #8 on: January 17, 2009, 10:05:52 AM »

Quote
I don't think this person is an expert, the advice about using :: instead of REM is a mistake, as I pointed out later in that thread.

So is there a way we could test this?
Like two version of a batch file with lots of long lines
of remarks and a timer at the end of the file?

Curious minds want to know.  ;D
IP logged

macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #9 on: January 17, 2009, 10:22:06 AM »

from what my ye olde MS-DOS book says:
"Remarks are skipped by the command proccessor..."

so i dont think it would make a difference in speed, and besides with proccessors getting faster and faster Batch programs dont have to worry about speed and processor time.  ;)
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Dias de verano
Guest
« Reply #10 on: January 17, 2009, 11:28:04 AM »

Rem.bat

@echo off
REM a REM remark

Dot.bat

@echo off
:: a dot remark

run each bat 50000 times

REM.bat
start  17:59:33.90
finish 18:06:41.40

7 minutes 7.5 seconds (427.50 seconds)

Dot.bat
start  18:06:41.43
finish 18:14:41.68

8 minutes 0.25 seconds (480.25 seconds)

So the dots were slower.

Moral:

Don't believe everything you read on web forums.

IP logged
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #11 on: January 17, 2009, 12:11:05 PM »

Quote
run each bat 50000 times

Full diskclosure requested.
How do you run a batch file 5000 times?
Maybe you are testing only the speed of the
robot that is hitting the enter key 5000 times.
While model aneroid way it?
IP logged

macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #12 on: January 17, 2009, 12:19:18 PM »

Rem.bat

@echo off
REM a REM remark

Dot.bat

@echo off
:: a dot remark

run each bat 50000 times

REM.bat
start  17:59:33.90
finish 18:06:41.40

7 minutes 7.5 seconds (427.50 seconds)

Dot.bat
start  18:06:41.43
finish 18:14:41.68

8 minutes 0.25 seconds (480.25 seconds)

So the dots were slower.

Moral:

Don't believe everything you read on web forums.



it was from a book, and i when it said "..skips.." i thought it didnt take time anyways, but since cmd has to check to see what command it is on each line, that would take up some time.
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Dias de verano
Guest
« Reply #13 on: January 17, 2009, 12:58:06 PM »

How do you run a batch file 5000 times?

It was 50,000 times, not 5,000.

This is Timer.bat. You call it with the number of repetitions required, e.g. Timer.bat 50000

Code: [Select]
@echo off
echo run each bat %1 times
echo.
echo REM.bat
echo start  %time%
for /L %%N in (1,1,%1) do call rem.bat
echo finish %time%
echo.
echo Dot.bat
echo start  %time%
for /L %%N in (1,1,%1) do call dot.bat %%N
echo finish %time%
echo.


Quote
While model aneroid way it?

Don't understand.



« Last Edit: January 17, 2009, 01:50:58 PM by Dias de verano » IP logged
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #14 on: January 17, 2009, 02:35:51 PM »

How are you getting it to repeat 5000 times? Do you have a robot (android) that bangs on the F3 and ENTER key 5000 times? How do we know the 7 o 8 minutes are not being mostly the time it takes to hit the keys 5000 times. You did not explain how you got the batch file to do 5000 times.
IP logged

Pages: [1] 2 3  All - (Top) Print 
Home / Microsoft / Microsoft DOS / What's the point of remarks? « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.125 seconds with 20 queries.