• JimmyVile (unregistered)

    I think it's neat, there have been quite a few occasions that I took on the challenge of writing things with batch files that no sane person should.

    Nothing as cool as this though.

  • Otto (cs)

    ... I can't explain why, but that code makes me want to punch something very, very hard.

  • Beavis (unregistered) in reply to Otto
    ... I can't explain why, but that code makes me want to punch something very, very hard.

    Are you like, angry at numbers, or something?

    There's like, way too many of them.

  • Someone (unregistered)

    3.14159th comment.

  • EFH (unregistered)

    Wow.

    Just... wow.

  • Rev. Creflo Baller (unregistered)

    Hats off to the coder, brilliant work!

  • Zygo (unregistered)

    That batch script...almost makes we want to install the software necessary to run it.

    Almost.

  • Zygo (unregistered) in reply to Zygo

    That script also apparently makes me use the grapefruit words sometimes.

  • The New WTF (unregistered)

    I have, in my long life, seen very few examples of working so hard to have everyone ask.. "Why The F?"

    I am amazed and nauseated at the same time. Bravo.

  • Mr B (cs)
    me:
    running out of actual, funny new content?

    Running out of actual, funny comments?

    I like reading stuff like that, it's still a WTF (of the re-inventing the wheel/using inappropriate technology genre) but it's a clever and deliberate WTF so worthy of closer inspection.

  • Trevel (unregistered)

    Way back when taking a computer course, we were all supposed to write a tutorial on some random part of computing. I was assigned batch files for some reason.

    Naturally, I wrote it as a batch file. (Excepting a small program I threw together to make up for the lack of any input-commands in DOS at the time.) Compared to the 'program' I'd written to pull things in and out of archive to save space on our 10M hard drive at home, it was pretty simple.

  • panzi (unregistered)
    Comment held for moderation.
  • Eric Lyna (unregistered)

    You're a geek, Don. That's why I like working with you.

  • Anonymous Coward (unregistered)

    The real WTF is that this batch file fails to calculate pi = 4*arctan(1)

  • nrq (unregistered)

    That batch file is not DOSBox compatible.

  • JHunz (unregistered) in reply to nrq
    nrq:
    That batch file is not DOSBox compatible.
    Because...it's a Windows batch file?
  • Don Cross (unregistered) in reply to Anonymous Coward

    The reason I use these complicated formulas is because the series expansion for arctan(1) takes forever to converge (try it in a spreadsheet).

  • Anon (unregistered)

    It's just gone 10 o'clock (am) and that is the most awesome thing I've seen today...so far.

  • Polestar (unregistered)

    Writing DOS batch files makes baby Jesus cry.

  • jimlangrunner (cs) in reply to Rev. Creflo Baller
    Rev. Creflo Baller:
    Hats off to the coder, brilliant work!
    I think that should be
    Hats off to the coder, brillant work!
    to fit in with the general them.
  • ajlb (unregistered)

    I once saw Perl master Damian Conway give a presentation called "Fun With Dead Languages" where he calculated Pi using POSTSCRIPT. It's actually turing-complete.

    The output looked really nice, though.

    He also, if I recall correctly, calculated primes using a parser for LATIN. He supposedly has another parser for Klingon, but it hasn't been approved by the Klingon Language Institute, and you don't want to get on their bad side.

  • Mithfindel (cs)

    I have a nice Windows batch implementation of an integer-only Vorbis decoder but the margin is too small to include it.

  • J.R. Blood (unregistered)

    I LOVE batch files, and this one just rocks.

    I still prefer using batch for simple things, like... oh mapping drive letters to network shares. You can do it in one line and it's simple.

    NET USE T: "\SERVER1\Team Design"

    Ever do it in a VBScript file? (NOTE: Copy-n-paste from someone else's VBS file, including the typo in the server name.)

    Set wshNetwork = CreateObject("WScript.Network") wshNetwork.MapNetworkDrive "t:", "\sever1\team design"

    Job security by complexity. There's a WTF for ya.

  • evilspoons (cs)

    I wrote a batch file front end for MP4Box for my specific task of losslessly cropping M4A files then renaming them - it would've been reinventing the wheel had YAMB not started crashing and freaking out on me, but it turns out I actually saved a lot of time by doing a FOR loop through my entire folder of hundreds of files.

  • DaveK (cs)
    The OP:
    so... now I can do... err....what?

    Well, now I can finally answer that question.

    Well, that give us the 'what', but you failed to answer the bigger question: WHY, in the name of all that's holy, why?

    (Also, "How long, oh Lord?" might be relevant here.)

  • Batchyx (unregistered)
    Comment held for moderation.
  • Franky (unregistered) in reply to J.R. Blood

    Wait, how is that example of VBScript more "complex" than NET USE? Sure VB forces you to create an object to get at the networking functions, but the alternative would be to have 1000 global functions like PHP4. Is that really any better? And is "NET USE" really any easier to understand then MapNetworkDrive?

  • Joey (unregistered)

    Aww, dang. I really need to get my batch bignum library working some day. I did a few things worth mentioning in batch but also, nothing as cool as calculating Pi. Not yet, though :)

  • pitchingchris (cs) in reply to J.R. Blood
    J.R. Blood:
    I LOVE batch files, and this one just rocks.

    I still prefer using batch for simple things, like... oh mapping drive letters to network shares. You can do it in one line and it's simple.

    NET USE T: "\SERVER1\Team Design"

    Ever do it in a VBScript file? (NOTE: Copy-n-paste from someone else's VBS file, including the typo in the server name.)

    Set wshNetwork = CreateObject("WScript.Network") wshNetwork.MapNetworkDrive "t:", "\sever1\team design"

    Job security by complexity. There's a WTF for ya.

    I don't agree with your assessment because of what it represents. net use is calling some code to do the work, underneath the scenes, there are many more lines of code that execute. You can't go by the fact that you only call 1 line that its any better. I can wrap up something into a console app, and the code behind it is much more intensive, and you'd never know the difference.

  • Mike D. (unregistered) in reply to ajlb
    Comment held for moderation.
  • Rehevkor (unregistered)

    "...the technology works well foa shortcut for typing in a bunch of commands."

    Apparently it's also effective for cocking up sentences.

  • brouski (unregistered)

    AR_K! AR_K!

  • Anonymous (unregistered)

    Well that was... pointless. Which is exactly what a stupid coding trick should be, so well done!

  • brouski (unregistered) in reply to brouski

    My god, I type like I've got two raccoons by the tail and I'm swinging them onto the keyboard

  • AdT (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    The real WTF is that this batch file fails to calculate pi = 4*arctan(1)

    Yes, calculating a power series with x=1 is a brillant idea.

  • Scott (unregistered)

    The real WTF is everyone praising this code that uses a ton of GOTO commands...

  • ... (unregistered) in reply to pitchingchris

    "I don't agree with your assessment because of what it represents." - Been reading dilbert?

    Maybe it's just good because it's quicker to type... 'and you'd never know the difference.'

  • hatterson (cs) in reply to Scott
    Scott:
    The real WTF is everyone praising this code that uses a ton of GOTO commands...

    Uhhhh....this is a batch file. use of GOTO is perfectly fine.

  • Butthead (unregistered) in reply to Beavis

    Wow. I thought I was the only one who remembered and laughed at insignificant lines from B&B.

  • Scott (unregistered) in reply to hatterson

    I'm not knocking the code at all, and understand the need of them in batch files. It's just amusing.

  • Scott (unregistered) in reply to hatterson

    Oops, hit reply instead of quote.. :(

    hatterson:
    Scott:
    The real WTF is everyone praising this code that uses a ton of GOTO commands...

    Uhhhh....this is a batch file. use of GOTO is perfectly fine.

    I'm not knocking the code at all, and understand the need of them in batch files. It's just amusing.

  • Smash King (cs) in reply to Scott
    Scott:
    The real WTF is everyone praising this code that uses a ton of GOTO commands...
    Care to tell us how to do flow control and loops in a batch file without them, please?

    Addendum: I posted together with your explanation, and I can't delete.

  • abstract protected synchronized final void longSignature() (unregistered) in reply to brouski
    brouski:
    My god, I type like I've got two raccoons by the tail and I'm swinging them onto the keyboard

    I have patent pending on that input method; You owe me royalties! Oh wait, you only type 'like' my method. Now how can I charge for that....

  • pjt33 (cs) in reply to Smash King
    Smash King:
    Scott:
    The real WTF is everyone praising this code that uses a ton of GOTO commands...
    Care to tell us how to do flow control and loops in a batch file without them, please?
    Recursion.
  • Smyle (unregistered) in reply to J.R. Blood
    Comment held for moderation.
  • Smash King (cs) in reply to pjt33
    pjt33:
    Smash King:
    Care to tell us how to do flow control and loops in a batch file without them, please?
    Recursion.
    Recursion could do as loops, but not as flow control (IFs) . And as far as I remember you need some sort of flow control to prevent your recursive calls going to the infinite.
  • Zost (unregistered)

    SINE! COSINE! COSINE! SINE! Three-point-one-four-one-five-nine!

    GO PI!

  • freespace (unregistered) in reply to AdT

    The infinite series expansion of arctan is not a power series, and there is nothing wrong with expanding a power series with x=1 either, provided it converges for x=1.

  • pjt33 (cs) in reply to Smash King
    Smash King:
    pjt33:
    Smash King:
    Care to tell us how to do flow control and loops in a batch file without them, please?
    Recursion.
    Recursion could do as loops, but not as flow control (IFs) . And as far as I remember you need some sort of flow control to prevent your recursive calls going to the infinite.
    The "them" was GOTO statements. You don't need GOTO statements to use IF statements.
  • Alin (unregistered) in reply to Rev. Creflo Baller
    Rev. Creflo Baller:
    Hats off to the coder, brilliant work!

    More like "brillant" work!

Leave a comment on “Stupid Coding Tricks: A Batch of Pi”

Log In or post as a guest

Replying to comment #:

« Return to Article