Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: A good tutorial site for batch programming?  (Read 15378 times)

0 Members and 1 Guest are viewing this topic.

Geek-9pm


    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: A good tutorial site for batch programming?
« Reply #15 on: February 23, 2014, 04:30:56 PM »
Thank you,
I was stinking o some kind of loop like:
Code: [Select]
For days in week do
  feed =feed + 5000 & 3%
end loop
echo feed
Of course, that is not batch code.
Not sure how it would be done using a FOR loop.
  :-\

Salmon Trout

  • Guest
Re: A good tutorial site for batch programming?
« Reply #16 on: February 24, 2014, 01:14:14 AM »
When you stated the question you required one answer:

Quote
How much feed should I buy for one week?

Anyhow, a day-by-day calculation could be done with or without a FOR loop:

Without:

@echo off
set totalfoodweight=0
set Horseweight=5000
set /a dailyfoodweight=3*(%Horseweight%/100)
set totalfoodweight=0

set day=1
:Loop
set /a totalfoodweight+=%dailyfoodweight%
echo Day %day% consumption: %dailyfoodweight% lbs total consumed: %totalfoodweight% lbs
set /a day+=1
if %day% LEQ 7 goto loop


Or with...

@echo off
setlocal enabledelayedexpansion
set Horseweight=5000
set /a dailyfoodweight=3*(%Horseweight%/100)
set totalfoodweight=0
for /L %%D in (1,1,7) do (
    set /a totalfoodweight+=%dailyfoodweight%
    echo Day %%D consumption: %dailyfoodweight% lbs total consumed: !totalfoodweight! lbs
    )


Either way this is the result:

Day 1 consumption: 150 lbs total consumed: 150 lbs
Day 2 consumption: 150 lbs total consumed: 300 lbs
Day 3 consumption: 150 lbs total consumed: 450 lbs
Day 4 consumption: 150 lbs total consumed: 600 lbs
Day 5 consumption: 150 lbs total consumed: 750 lbs
Day 6 consumption: 150 lbs total consumed: 900 lbs
Day 7 consumption: 150 lbs total consumed: 1050 lbs






Salmon Trout

  • Guest
Re: A good tutorial site for batch programming?
« Reply #17 on: February 24, 2014, 01:28:16 AM »
Anyhow, this is a poor example; it just so happens that the (very simple) arithmetic involves small whole numbers only. Batch scripting was designed to do simple tasks mainly in system administration. It runs out of power and usability when you try to do anything remotely complex. Also, where I live, if you tried to order "1050 pounds" of horse feed the suppliers would say "how many kilos is that?". (If you went to Baileys you might get 53 twenty-kilo sacks)



Interesting:

Ideal for horses and ponies at rest or in light to moderate work.

Free from whole oats!

COMPOSITION
Oatfeed, Micronised Barley, Grassmeal, Alfalfa & Oat Straw Chaff, Micronised Wheat, Wheatfeed, Micronised Maize, Micronised Peas, Extracted Sunflower Meal, Soya Oil, Honey (1.5%), Molasses, Dicalcium Phosphate, Spearmint (0.1%), Calcium Carbonate, Vitamins and Minerals, Sodium Chloride, Calcined Magnesite

They describe this as "delicious" - do they know that from experience, or did they get it straight from the horse's mouth? If that's what they give you for lunch, I don't think I want to work at Baileys Horse Feeds. I'd try to be a team player, and have a "passion for the product", but that much would be beyond me.



« Last Edit: February 24, 2014, 01:39:47 AM by Salmon Trout »

Salmon Trout

  • Guest
Re: A good tutorial site for batch programming?
« Reply #18 on: February 24, 2014, 03:01:55 AM »
Also, bearing in mind that a 1,000-pound horse will produce 35 to 50 pounds of wet manure (faeces plus urine) daily, one could modify the script to show how much dooky needs to be carted away, but I shall leave that as an exercise for the student. There is also the question of bedding.

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: A good tutorial site for batch programming?
« Reply #19 on: February 24, 2014, 04:10:00 AM »
A task for a script could be to calculate how much material would be required to sew a horse nappy, and also calculate the water and detergent used to launder several nappies per day. ;)

patio

  • Moderator


  • Genius
  • Maud' Dib
  • Thanked: 1769
    • Yes
  • Experience: Beginner
  • OS: Windows 7
Re: A good tutorial site for batch programming?
« Reply #20 on: February 24, 2014, 07:57:04 AM »
Quote
I am on a one-mane crusade
" Anyone who goes to a psychiatrist should have his head examined. "

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8

Geek-9pm


    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: A good tutorial site for batch programming?
« Reply #22 on: February 24, 2014, 11:40:51 PM »
Quote
The Meaning of ROFL
What does ROFL mean? ROFL is an acronym, abbreviation or slang word that is explained above where the ROFL definition is give
ROFL means "Rolling On Floor Laughing"
 

So now you know - ROFL means "Rolling On Floor Laughing"
 :rofl:   :rofl:

Whitebeard1

    Topic Starter


    Intermediate

    Thanked: 2
    • Computer: Specs
    • Experience: Familiar
    • OS: Mac OS
    Re: A good tutorial site for batch programming?
    « Reply #23 on: February 26, 2014, 01:01:10 AM »
    Hey, thanks for all these replies. Some very interesting posts there :)
    But batch programming as a profession???
    I'm not sure how they can earn a living.
    I thought batch programming is very limited.
    Thanks,
    Whitebeard1
    Computers follow your orders, not your intentions.

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: A good tutorial site for batch programming?
    « Reply #24 on: February 26, 2014, 01:22:56 AM »
    Quote
    But batch programming as a profession???
    I'm not sure how they can earn a living.
    I thought batch programming is very limited.
    Yeah, that's what I say too.
    But here is an allegory that may help.
    Just image hat IT  In dusty was the  Heath Care Industry.
    Heath Care Industry.
      Toot problem? got the dentist.
      Eye problem? Go to the Ophthalmologist.
      Urine problem? Go to the urologist
      Depression? go tot he psycho analyst
      Nutrition problems? Go to the health food professional.
     

    So, in the IT industry we would have:
    Information Technology
      Malicious software? Go to the security analyst.
      Device drive issue? Got o the hardware technician
      CPU Overheat? Go to the system Engineer.
      Command script woes? See a Batch professional.


    Does that help?  ::)

    Salmon Trout

    • Guest
    Re: A good tutorial site for batch programming?
    « Reply #25 on: February 26, 2014, 01:58:55 AM »
    But batch programming as a profession???
    I'm not sure how they can earn a living.
    I thought batch programming is very limited.

    If you are a system admin, whipping up a batch script is certainly a handy skill to have, but it would not be the foundation of your career, by any means. Any more than just knowing how to use a screwdriver would make you a carpenter or engineer.

    Whitebeard1

      Topic Starter


      Intermediate

      Thanked: 2
      • Computer: Specs
      • Experience: Familiar
      • OS: Mac OS
      Re: A good tutorial site for batch programming?
      « Reply #26 on: February 26, 2014, 02:10:36 AM »
      I see. Thanks for the replies. So batch programming is not the foundation of one's career? Are the 'batch professionals' just IT professionals who have extensive knowledge in batch?
      Also, if I'm going to use a new type of programming language, because batch is very limited, which language would you suggest?
      C++? Python?
      Any help would be appreciated!
      Computers follow your orders, not your intentions.

      foxidrive



        Specialist
      • Thanked: 268
      • Experience: Experienced
      • OS: Windows 8
      Re: A good tutorial site for batch programming?
      « Reply #27 on: February 26, 2014, 05:10:49 AM »
      I kinda think that most people with good batch skills these days are enthusiasts first and foremost.

      Batch is easy to launch - you just need a text editor - so many people dabble with it to begin with but
      I'd guess that most of them would gravitate to another scripting language or a higher level language.

      Modern IT admin people seem to learn and prefer Powershell - you see many of them say over and again that "batch is dead and why not try powershell".


      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: A good tutorial site for batch programming?
      « Reply #28 on: February 26, 2014, 10:50:15 AM »
      Powers *censored* is already in Windows 7
      In has to be installed in Windows XP

      http://en.wikipedia.org/wiki/Windows_PowerShell

      patio

      • Moderator


      • Genius
      • Maud' Dib
      • Thanked: 1769
        • Yes
      • Experience: Beginner
      • OS: Windows 7
      Re: A good tutorial site for batch programming?
      « Reply #29 on: February 26, 2014, 10:54:23 AM »
      Quote
      I was stinking o some kind of loop like:

      Quote
      Powers *censored* is already in Windows 7

      And the hits just keep on coming... :P
      " Anyone who goes to a psychiatrist should have his head examined. "