Slashdot Mirror


For Automated Testing, Better Alternatives To DOS Batch Files?

An anonymous reader writes "I am working on a project that would allow our customers to test out sending different PCL commands to LAN printers. My initial thought was that a DOS batch file will allow users to select some simple options, send the tests to printers, and even generate a small web page which, when launched from the batch file, will provide email feedback on the tool. This all worked. To spice it up I added some ANSI color commands to the menus, though the implementation of that may prove tricky without resorting to .COM files or forcing the load of the ansi.sys via the command.com shortcut. And this implementation goes against my initial idea that I want the entire thing to be contained in a standalone batch file. My questions are: Is there a better option for this? Are DOS Batch files too 1990s to be taken seriously in 2010? The application needs to (1) be simple (2) be easy to update (3) be able to send PCL commands to LAN-attached printers and (4) allow email feedback. I don't know what other programming language would allow this and be as simple. I tend to think that I have found the best tool for the job but if you have another idea let me know. Call me crazy but I love DOS."

85 of 426 comments (clear)

  1. DOS Is dead use visual basic by Joe+The+Dragon · · Score: 5, Funny

    DOS Is dead use visual basic

    1. Re:DOS Is dead use visual basic by Anonymous Coward · · Score: 5, Funny

      DOS is dead, and no-one cares
      If there is a shell, I'll see you there

    2. Re:DOS Is dead use visual basic by Monkeedude1212 · · Score: 2, Insightful

      Yeah. VB, C++, Java, they all do PCL commands.

      Easiest way is to Build yourself a Win32 GUI, since thats what your users probably use already.

    3. Re:DOS Is dead use visual basic by game+kid · · Score: 5, Funny

      Visual Basic sucks. Get Firefox instead.

      --
      You can hold down the "B" button for continuous firing.
    4. Re:DOS Is dead use visual basic by v1 · · Score: 4, Informative

      +1 agree. VB is RAD (rapid application development), is very flexible, and is easy to use to make standalone apps. if you like programming in dos, you will love VB. For the use you are suggesting, it sounds ideal. you can basically have it be the gui front end for things you need to be done in dos (via vb, you don't need a folder full of com files for it to use)

      --
      I work for the Department of Redundancy Department.
    5. Re:DOS Is dead use visual basic by codepunk · · Score: 2, Interesting

      No but now your folder of com files will require a butt load of runtime files on every single workstation. Now personally I would smack it out as a stand alone executable in delphi, but that is just me.

      --


      Got Code?
    6. Re:DOS Is dead use visual basic by buchner.johannes · · Score: 5, Insightful

      It is important to know your alternatives (e.g. you have many scripting options through cygwin, python, perl), but:
      Use whatever works for you, and don't be ashamed just because it is not the current trend. You know your requirements (easy to maintain). Don't believe the people that say you have to rewrite everything.

      --
      NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
    7. Re:DOS Is dead use visual basic by i.r.id10t · · Score: 3, Funny

      I agree, if you are stuck on ms stuff then VB becomes your "shell scripting" language of quickness.

      This being /. though, I'll have to mention a small customized LiveCD (think DSL sized) with a (perl script | python script | brainfuck implementation | emacs extension | vi/vim script | whatever) with i/o to the user being prettified by some shell/exec stuff with zenity or by developing a graphical app using qt/gtk/whatever. Distribute as a business card cd or a bootable usb key. Have the marketing dept come up with some video, etc. to put on it, make it a bigger CD.

      --
      Don't blame me, I voted for Kodos
    8. Re:DOS Is dead use visual basic by Homr+Zodyssey · · Score: 4, Informative

      I often write stuff like this using javascript or vbscript, and run it with "cscript". Its included in WinXP and later, so there's no installation required -- just a js or vbs script file. So, it would function much like your Batch file but you'd have a more descriptive language to work with.

      I do think vbscript is da debbil. However, it does have its uses when it comes to interacting with Office documents.

    9. Re:DOS Is dead use visual basic by Anonymous Coward · · Score: 5, Funny

      Rebooting your computer into another OS to test a printer?

      Do you meatbags SEE why you're not commercially viable as developers?

    10. Re:DOS Is dead use visual basic by Bigjeff5 · · Score: 4, Insightful

      They're also all a thousand times more complex than DOS.

      Even simple VB Script is significantly more complicated than DOS batch files.

      My advice? If it's internal to the company and only a few users are going to use it, a batch file is fine. If you're selling it, or a lot of people are going to be using it frequently, take the time to write a simple VB app to do the job. Something like this is so easy it would only take you an afternoon to do even if you've never used VB before, and it will look a much more professional.

      If you want to just make a more professional looking wrapper for it, you can use shell commands in a VB app and not waste any of your work in the DOS script.

      --
      Security is mostly a superstition... Avoiding danger is no safer in the long run than outright exposure. - Helen Keller
    11. Re:DOS Is dead use visual basic by Anonymous Coward · · Score: 3, Insightful

      4.3
      A master was explaining the nature of Tao of to one of his novices. “The Tao is embodied in all software – regardless of how insignificant,” said the master.
      “Is the Tao in a hand-held calculator?” asked the novice.
      “It is,” came the reply.
      “Is the Tao in a video game?” continued the novice.
      “It is even in a video game,” said the master.
      “And is the Tao in the DOS for a personal computer?”
      The master coughed and shifted his position slightly. “The lesson is over for today,” he said.

      From The Tao of programming – Chapter 4: Coding

    12. Re:DOS Is dead use visual basic by BikeHelmet · · Score: 3, Insightful

      There's nothing wrong with cmd files. Some very advanced things are built using them.

      HFslip - hotfix slipstreamer.

      BATCH is a good quick&dirty tool, for quick&dirty jobs. Right now I'm using cmd files to manage cmdline folding clients. They're installed as services, but they start up faster than everything else, and then slow down other stuff loading. Now, thanks to my quick and dirty batch scripting, they get started after everything else. (on XP) With a single command I can toggle them off so they don't come on after a reboot, which is handy if I was rebooting to play a game.

      I considered using Java, but it's just not worth the time. It took 2 minutes to write the first script in batch, and less than 20 minutes to refine it.

    13. Re:DOS Is dead use visual basic by SpectreBlofeld · · Score: 4, Insightful

      It sounds to me like the current implementation is not only effective and clever, but is (Windows) version-independent, and doesn't require any installation of third-party tools or utilities.

      Dude, you've created the Holy Grail of software. Why are you looking for alternatives?

    14. Re:DOS Is dead use visual basic by dhalgren · · Score: 2, Funny

      *whoosh*

    15. Re:DOS Is dead use visual basic by vtcodger · · Score: 2, Insightful

      ***I would say that whatever method that works for you is fine.***

      Absolutely. Provided that the numerous peculiarities of Microsoft's command language aren't an issue (will the users ever see the inards?), and you don't have to support Unix, why would anyone not use a scripting tool that requires no additional run time be installed?

      --
      You can't see ANYTHING from a car, You've got to get out of the goddamned contraption and walk...Edward Abbey
    16. Re:DOS Is dead use visual basic by Lumpy · · Score: 2, Insightful

      Have you looked at VB.net or C#.net?

      It's not simple anymore. VB6 was the last "simple" vb.

      Honestly, he should just jump to a real language as it will take the same amount of effort to get up to speed in C++ as it does to get up to speed in a inferior language like VB.net

      Actually for rapid development right now Delphi is the new king in Rapid and easy design for simple apps like this. I was a VB6 guru, when VB.net and C#.net came out I started learning it and started dabbling in delphi. I was up to speed in delphi way faster than VB.net...

      Less effort spent getting things going if he looks at delphi instead.

      --
      Do not look at laser with remaining good eye.
    17. Re:DOS Is dead use visual basic by fbjon · · Score: 4, Insightful

      Hardly a cardinal sin. I've made a few in my day with loops and multiple choices using labels and gotos and such. Declare all important variables upfront, comment reasonably, and give it the same amount of testing as you would in a "real" language. The fact that batch files have no dependencies is a pretty good advantage, and the interpreter is backwards compatible.

      Shell scripts under *nix may be more functional, but batch files are perfectly serviceable, as long as you don't go on insane writing sprees with them.

      --
      True confidence comes not from realising you are as good as your peers, but that your peers are as bad as you are.
    18. Re:DOS Is dead use visual basic by Random+BedHead+Ed · · Score: 4, Insightful

      I'm surprised no one has suggested the most obvious upgrade path from the DOS batch file, Windows PowerShell. It's the intended replacement for batch files, and basically looks like Perl, but a little more Windowsy. It's integrated with lots of .NET goodies and ActiveDirectory, but in many ways it will be familiar to DOS scripters.

  2. perl? by FooAtWFU · · Score: 3, Informative

    There's Windows ports of Perl, both Cygwin and ActiveState, last I checked.

    --
    The World Wide Web is dying. Soon, we shall have only the Internet.
    1. Re:perl? by steveg · · Score: 4, Interesting

      Even better Strawberry Perl

      --
      Ignorance killed the cat. Curiosity was framed.
    2. Re:perl? by CrimsonAvenger · · Score: 2, Interesting

      There's Windows ports of Perl, both Cygwin and ActiveState

      Which pretty much blows a hole in the "single file" concept, since you'd need to include the Perl installations, and update same from time to time.

      --

      "I do not agree with what you say, but I will defend to the death your right to say it"
    3. Re:perl? by BJ_Covert_Action · · Score: 5, Insightful

      I'll second this one. The place that I work runs almost all of its commands via bat jobs that run from simple to complex. When I started here, I installed Strawberry Perl on my win32 system. I have, since, replaced every functionality that the bat jobs used to do with perl scripts (primarily for my own purposes, but most of my coworkers don't mind them either). The primary reason I did this was readability. I can set up my perl scripts in such a manner that I can look at them a year later and know exactly what I did and how I did it. All I had to do was be a little disciplined about script formatting and variable names (it's really not that hard).

      So far, I've gotten Strawberry perl to print to all of the printers on my network, run some old fortran programs successfully, update an in-house wiki automatically, automate e-mails to my co workers, and crash our entire network (that last one wasn't so much a feature, but hey, it shows just how powerful perl is). That said, I think with a bit of time and research you could probably get Strawberry perl to do exactly what you needed pretty easily. But I will warn you, when it comes to perl, I find that user experiences vary greatly.

    4. Re:perl? by BJ_Covert_Action · · Score: 5, Informative

      Oh, I should caveat one thing. In order to develop perl scripts into a distributable, platform independent, one click executable, I've been using the PAR packager module for perl. Sometimes it produces slightly bloated .exe's (since it has to bring in all of the relevant code from any external modules and dependencies), but it seems to produce very stable executables on win32 systems.

    5. Re:perl? by digitalunity · · Score: 3, Insightful

      Probably the simplest solution would be to make a Win32 executable based on the Qt toolkit and statically linked. You get a single executable, a professional looking UI that took minutes or hours to build, and the advantage of a much more powerful and flexible language versus DOS batch files or even powershell scripts.

      Qt also provides a dead simple class framework for accessing the network, so that will save you time. You can get Qt, including a really slick IDE for free from Nokia.

      --
      You can't legislate goodness. Let each to his own destiny, by will of his freely made choices.
    6. Re:perl? by Anonymous Coward · · Score: 3, Interesting

      You can cut the bloat by making the executables dependent on an external perl5lib.dll file. You can also factor out common libraries into separate PAR packages to be used by your executables. But this blows the whole point of bound exes in my opinion, and disk is cheap.

    7. Re:perl? by nicks,nicks,nicks! · · Score: 3, Funny

      I'll second this one. The place that I work runs almost all of its commands via bat jobs that run from simple to complex. When I started here, I installed Strawberry Perl on my win32 system. I have, since, replaced every functionality that the bat jobs used to do with perl scripts (primarily for my own purposes, but most of my coworkers don't mind them either). The primary reason I did this was readability.

      That's the first time I've heard Perl and better readability together.

  3. If It Works, It Works But Remember Your Customers by eldavojohn · · Score: 4, Insightful

    I don't know who your customers are ... is this a sort of IT mass production heavy printer thing you're producing? I'm guessing so if they're LAN printers but who knows? Anyways if you're shipping this thing to residences, give the tool to your parents or -- failing that -- someone age ~15 or ~65. Give them the documentation you have and do not say a word. See what they do with it and how intuitive it is to them and take notes while they're using it. Do they successfully test the printer or fail? If they fail, that's actually your failure. So know your audience and maybe rethink the tool. But assuming that your audience isn't afraid of a command line interface, go for it. I guess you could look into whether or not Powershell gives you any advantages (probably not). You're in a different world than I so that last suggestion may be off the mark.

    --
    My work here is dung.
  4. Powershell by Shados · · Score: 4, Interesting

    The modern way of doing shell scripting in Windows is now powershell, and most things are quickly moving toward that. Its not as integrated in the OS, but its damn close, and in many ways its better than alternative scripting languages (object piping instead of text piping, for example).

    Now if its the best thing for your requirement? I don't know. But if you're planning to stick to shell scripting, do yourself a favor and upgrade.

    1. Re:powershell by digitalunity · · Score: 2, Informative

      It doesn't, but you can download it.

      --
      You can't legislate goodness. Let each to his own destiny, by will of his freely made choices.
    2. Re:Powershell by isThisNameAvailable · · Score: 2, Informative

      If DOS made you happy, then Powershell could drive you to orgasm if you let it. Object-oriented scripting that can tap into .NET, WMI, COM objects, Windows APIs, and still read/replace part of a text file in one line. You will have to install it on older clients, but what you want can be done with Powershell 1.0, which is like 2MB.

    3. Re:Powershell by KibibyteBrain · · Score: 2, Interesting

      It is worse because it suddenly makes one of the proposed strengths of the *nix platform look obsolete, and this is Slashdot.

    4. Re:Powershell by EvanED · · Score: 2, Funny

      The moderators are having a field day with this one.

  5. Python would be my first choice. by jgritty · · Score: 4, Insightful

    Python would be my first choice.

    1. Re:Python would be my first choice. by Rob+the+Bold · · Score: 3, Insightful

      nobody cares what you think.

      I dunno. At least one guy cared enough to respond.

      --
      I am not a crackpot.
  6. Python by bmecoli · · Score: 3, Informative

    Python is my scripting language of choice because it's easy to use and it has it's own "os" module that you can use to launch commands and the like, not to mention the "glob" module, which can grab all file names in a given directory into an array. I highly recommend it. (2.6)

    1. Re:Python by lmpeters · · Score: 2, Informative

      Python is my scripting language of choice because it's easy to use and it has it's own "os" module that you can use to launch commands and the like, not to mention the "glob" module, which can grab all file names in a given directory into an array. I highly recommend it. (2.6)

      Python also has a built-in "unittest" module that might make it a lot easier to manage your various test cases. I'd say if you can't count all of your test cases on one hand, you should take a serious look at that module.

  7. AutoIt? by Anonymous Coward · · Score: 5, Informative

    Its a great tool thats free, and has good GUI and has good scripting capabilities too:

    http://www.autoitscript.com/autoit3/index.shtml

  8. Try Windows PowerShell by UTF-8 · · Score: 3, Interesting

    DOS batch files has too many limitations when compared to other scripting languages. It's frozen in time. I consider Windows PowerShell to be the batch file successor.
    http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx

  9. Okay by srwalter · · Score: 3, Funny

    You're crazy.

    --
    Freedom is the freedom to say that 2 + 2 = 4
  10. Execute Shell commands with Ant by decipher_saint · · Score: 2, Interesting

    Not sure why batch is such a bitch, but you can execute shell commands with Ant.

    --
    crazy dynamite monkey
  11. 15 minutes could save you... by schmidt349 · · Score: 3, Funny

    Are DOS Batch files too 1990s to be taken seriously in 2010?

    Is Ed "Too-Tall" Jones too tall?

    1. Re:15 minutes could save you... by Bigjeff5 · · Score: 3, Funny

      Does Charlie Daniels play a mean fiddle?

      --
      Security is mostly a superstition... Avoiding danger is no safer in the long run than outright exposure. - Helen Keller
  12. He's right. by Anonymous Coward · · Score: 3, Informative

    For Windows platforms, there's nothing better for rapid prototyping than VB.NET - or really any of the .NET languages. Plus, you can get a version of Visual Studio from Microsoft for free that will do everything you want. Plus, you definitely won't regret having VS as a debugging environment.

    Think of how happy your customers will be to interact with a modern-looking app that only took you a few hours to put together!

    1. Re:He's right. by Anonymous Coward · · Score: 4, Informative

      AutoHotKey or AutoIt are better and they are free unlike Visual Basic.

    2. Re:He's right. by kelsey.grammer · · Score: 5, Informative

      AutoHotKey or AutoIt are better and they are free unlike Visual Basic.

      Mod this up. I've used C++, Java, Perl, Ruby, vbscript, batch, and likely a few more to do this kind of thing in Windows over the years. For something this small I haven't found anything that beats AutoIt. It's so easy to learn and is fantastic for creating small, standalone executables with a GUI on Windows. This task is a perfect fit.

      --
      I reflect your pompous signature back upon you.
    3. Re:He's right. by Machtyn · · Score: 2, Informative

      I disagree. Use Tcl/Tk, Perl/Tk, or any other cross OS scripting language that contain a graphical toolkit. Using Tcl/Tk at my last job, I was able to create some nifty little utilities with a GUI, and I didn't have to worry about compiling. I also didn't have to install Tcl/Tk on each computer that was going to use it, as I used a wrapper to put it together for release.

      I still used the command shell fairly extensively when it was needed and I used C# when it was called for. Right tool for right job and all that.

      Windows Vista or later have a SUA (Subsystem for Unix Applications) and Powershell. While I have only just started looking into Powershell, it looks like a very good shell for Windows systems that finally (almost) brings it up to Linux/Unix standards of a shell.

    4. Re:He's right. by MadKeithV · · Score: 2, Informative

      Mod parent up - Visual Basic *SCRIPTING* is free on the windows platform.

    5. Re:He's right. by teridon · · Score: 4, Informative

      AutoIt is nice -- the first time. That's how they hook you.

      Then, a year later, you decide to update your program. And hey, why not update to the latest version of AutoIt while you're at it? There was this one bug that always annoyed you, and you hope the devs fixed it.

      Well, guess what? While you had your back turned, all the APIs for the GUI changed. All those calls you made to AwesomeFunction() now require 4 arguments instead of 3. Oh, and one of them is now an object instead of string.

      That was my personal experience, anyway. After wroting a GUI program with perhaps 3000 lines of code, I updated to the new version of AutoIt. It seemed I had to practically rewrite the entire thing. Since then, I haven't recommended AutoIt to anyone that I like.

      --
      I hold it, that a little rebellion, now and then, is a good thing. -- Thomas Jefferson
  13. dig your boldness by Crackez · · Score: 3, Informative

    must be nostalgic for you or something...

    If it were me, I would put together what you need to work with Cygwin, then it could be cross platform. You could even ship a copy of cygwin.dll and any binaries you need, like bash, netcat, or what have you. I prefer Unix apparently.

    1. Re:dig your boldness by kybred · · Score: 2, Informative

      You could even ship a copy of cygwin.dll and any binaries you need, like bash, netcat, or what have you. I prefer Unix apparently.

      Be careful about that.

      I use Cygwin myself, but copying the .dll for use with your app is fraught with peril.

  14. Sensible Suggestion... by Elitist_Phoenix · · Score: 2, Funny

    I believe the only sensible and practical idea here is to have 1000 monkeys at 1000 consoles doing these automated tasks for you. Of course you'd need to feed these monkeys, so you'd need more monkeys. Thus, 1000 monkeys at 1000 banana plantations.

    --
    "I'm going to f***ing bury that guy, I have done it before, and I will do it again. I'm going to f***ing kill Google"
  15. Hate to say it... how about vbs? by Anonymous Coward · · Score: 5, Informative

    Python is much easier to write and much more maintainable than a batch script. Unfortunately it can be unfeasible to require this dependency on Windows machines.

    Good dependency-free (albeit platform-specific) alternatives are .vbs (visual basic script) and .js. Both allow access to more modern dialog boxes etc. Either script should be executed under wscript.exe (windows scripting host) but I believe there is an automatic file association by default (at least for .vbs files).

    For a more modern alternative, try Powershell, however it is only present by default on Windows 7.

    1. Re:Hate to say it... how about vbs? by rubies · · Score: 2, Informative

      I second VBS - asking a customer to install Perl is just asking for trouble unless you're in Unix land. The reason Bourne shell is popular isn't because it's particularly good, but because you know it (or a close variant) will always be available on any *nix.

      VBS isn't particularly nice to program in, but if you know what you're doing you can call most windows functions and even do database queries if that floats your boat. Networking stuff is a breeze and you can do a dialog based GUI if necessary.

    2. Re:Hate to say it... how about vbs? by ImprovOmega · · Score: 3, Informative

      The biggest advantage of VBScript is its easy exposure of practically all COM API's on the machine. This lets you run a ridiculous amount of automation tasks from VBScript, but you are horribly limited in the sense that it's really not an object oriented language. It lacks ability to do pointers and even structs (C-style structs that is) making any kind of advanced data structures cumbersome to implement. But for scripting it's leaps and bounds above batch files *shudder* so I have to give it a nod for the original question.

      The one big problem with going GUI though is that its GUI objects do lend themselves to much customization. You cannot, for instance, create a list of buttons to pick from. You would almost want to use the cscript interface and go from there. That still embeds you in a DOS window, but hey.

      Also VBSEdit is a killer IDE for developing VBScripts. It will even produce straight executables for you to help cut down on people breaking your plaintext scripts.

    3. Re:Hate to say it... how about vbs? by shutdown+-p+now · · Score: 4, Informative

      Indeed, Active Scripting with VBscript or JScript is the only alternative if it has to run without any extra dependencies. It's available as a stock component from at least Win2K (I believe it's actually Win98, but can't be bothered to check; and I'm certain about Win2K). And while VBScript is ugly, JScript is a rather decent interpreted implementation of Ecma-262, and has enough hooks to do the stuff that is required here. And it's infinitely better than DOS batch files, that's for sure.

    4. Re:Hate to say it... how about vbs? by forkazoo · · Score: 2, Funny

      Python is much easier to write and much more maintainable than a batch script. Unfortunately it can be unfeasible to require this dependency on Windows machines.

      You can just make an exe out of a python script which collects the runtime and all dependencies into a single file. I'd want to do that before resorting to invoking VB. I guess if it is an all-MS shop locked in some sort of hellish time vortex (which is consistent with the OP asking about batch files) then they may keep enough Eye of Newt and pentagrams handy to make VB seem like a convenient option.

  16. Re:If It Works, It Works But Remember Your Custome by NFN_NLN · · Score: 3, Insightful

    Give them the documentation you have and do not say a word

    If your product requires a manual than your user interface sucks.

    Add a wizard for common scenarios... anything but documentation that no one will read.

  17. Re:Is it pronounced DOHS or DAHS? by Hatta · · Score: 3, Informative

    DOS sounds like "Boss" not like "dose".

    --
    Give me Classic Slashdot or give me death!
  18. I have a saying by buss_error · · Score: 5, Insightful

    "If it's stupid and it works, it's not stupid."

    There are plenty of doges you can use, perl, python, bash, and lots more. But all of them add a level of complexity to this that the batch file doesn't have. Which leads me to my second saying:

    "If it's simple and it works, it's elegant."

    Sounds like you've found an elegant solution to a problem. I'd stick with it if it works for you.

    --
    Necessity is the plea for every infringement of human freedom. It is the argument of tyrants; it is the creed of slaves.
    1. Re:I have a saying by Mr.+Underbridge · · Score: 2, Informative

      There are plenty of doges you can use, perl, python, bash, and lots more. But all of them add a level of complexity to this that the batch file doesn't have.

      What complexity does python add (for instance)? From the user's standpoint, if the .py file is associated with python (and it will be), double-clicking on the icon will run just like a batch file. And as pointed out, python can execute system commands too.

      I can see wanting to avoid cygwin, but python's a breeze.

    2. Re:I have a saying by __aaubnk9535 · · Score: 3, Informative

      I can see wanting to avoid cygwin, but python's a breeze.

      Except for the fact that python run-time libraries aren't included with Windows, yeah, great.

    3. Re:I have a saying by Bigjeff5 · · Score: 2, Insightful

      Batch scripts are for very simple operations - it's literally just command line commands all at once (rather in order, as though they were one command). All of the methods implemented in batch are actually implemented in the DOS command prompt, the script just executes it as though you had punched it into a command prompt.

      What this means is, if you've been using DOS for a very long time, and know the commands and syntax backwards and forwards, there is no simpler tool on the planet for a job a batch script can handle than a batch script. It is virtually 1:1 for entering commands into a command prompt. It has very minor extended functionality, which is what makes it so doggone easy to use.

      As you've pointed out, there are a number of things batch cannot do, for exactly the reasons I gave for its ease of use. But, if a batch program does what you need, why in god's name would you use anything more complicated than that?

      I actually ask questions at interviews to try to find people with your philosophy and weed them out.

      And you're a fool for doing so, particularly because you don't understand the GP's philosophy at all. He's applying basic engineering concepts, like Keep It Stupid Simple, and you're weeding him out because he doesn't use whichever useless design paradigm flavor of the month you prefer.

      The fact that you'd rather he write a whole complicated program to do the job instead of a simple script, without knowing how such an app is going to be used by his customers, just screams idiot to me. More complicated is never, ever better. Assuming you can do the exact same thing with something simpler, at the very least you've wasted time and effort by choosing the more complicated option. I don't know who told you batch scripts were hard to maintain, there is literally nothing to maintain. They are command line commands. If it works in the command line it works in the batch script. /? is your friend, and a lot more helpful than anything you'll get in even the best IDE's.

      That said, depending on who the customer is (he could be using corporate speak for individuals within his company, we use the term as well), and how often they would want to use this, an application could be warranted. If his customers are regular-joe consumers, they're probably not going to use the app at all, in which case you're probably leaving the tool for PC repair folks, so a batch script is a really good idea. The repair guy will be able to tell immediately what the script does and understand what information it's giving him. If your customer is some other department in your company whose end users may or may not need to run it often, then I'd build a simple app to do the job.

      Basically, if it's for the IT guys, the script is more helpful. If it's for the end users, an app looks much more professional. There are various options between scripts and apps that you can use depending on how much effort this warrants.

      --
      Security is mostly a superstition... Avoiding danger is no safer in the long run than outright exposure. - Helen Keller
  19. If .bat will do it, stick with .bat! by Anonymous+Freak · · Score: 5, Insightful

    PowerShell is the new Batch File Scripting, so if you need more power, learn PowerShell and use that. (I am assuming you're in a Windows environment where change of OS isn't an option.)

    But DOS batch files still work just fine. In my last job at $major-hardware-vendor, we used DOS batch file-based menus all the time; because they were simple, they got the job done, and all the people who had any need to maintain them knew all about them. Some were particularly large/gnarly batch files, too. (Think 3 KB of one single .bat file menuing to do a few dozen tasks.) When choice is used liberally, along with variables, you can make it very simple to maintain, too. (We used it for updating various things, and the very first section was where all the variables were set, all you had to do when it came time to update was throw the updated file in the right place, and change a number in the batch file.)

    --
    Another non-functioning site was "uncertainty.microsoft.com."
    The purpose of that site was not known.
    1. Re:If .bat will do it, stick with .bat! by Jaime2 · · Score: 2, Interesting

      But DOS batch files still work just fine.

      I've found that UAC in Vista and Windows 7 hate batch files. Some of my old processes that are still batch file based fail silently on new operating systems. Suck it up and move into the 1990's at least.

  20. Assuming nobody is whining... by fuzzyfuzzyfungus · · Score: 4, Insightful

    Why would you consider messing with something that works?

    Your description suggests that, for anybody who doesn't really want to get their hands dirty, there is an adequate if rather retro menu driven interface. Great. A little reading never hurt anybody important.

    Even better, if your application is written within the limitations of CMD batch files, it'll be trivial for any admin who cares and has a copy of notepad to pick it apart, if needed.

    I, for one, fucking hate shiny-but-opaque vendor tools("Oh, great, you made it so easy that a trained monkey could do it, once. I need to do it 10,000 times, I see that your only officially supported method is '10,000 trained monkeys'. Would it have killed you to include some useful command-line options?". If your application is "send PCL test commands to networked printers" you ain't selling to grandma and cousin jim-bob. You may well be dealing with somebody who might need to programmatically test dozens or hundreds of printers. He will appreciate being able to rework your tool.

    CMD sucks; but it ships with every version of Windows since ever, and(since you've already written your application) apparently its limitations didn't cripple you. Why mess with it?

    1. Re:Assuming nobody is whining... by X3J11 · · Score: 2, Informative

      Actually.. cmd did not ship with every version of windows. Only since Windows 95. Prior to that, you required DOS, and DOS equivalent was command.com.

      Actually.. cmd did not ship with Windows 95. Only Windows NT got the native cmd.exe, which was compatible with command.com anyway.

      Make sure you're right when you're trying to correct someone else.

  21. If you do use VB... by transporter_ii · · Score: 4, Informative

    Did some quick research on it and it does look like it would work. But I did find this information:

    http://www.tek-tips.com/viewthread.cfm?qid=655463&page=6

    But here's the problem.... usually, when you use the printer object in VB to print with, it puts MORE PCL code round what you send (or PostScript, depending on the driver you use) and that messes the whole thing up.

    So one of my colleagues found a reference at MicroSoft on how to do what they call Raw Printng, which is direct to the printer not thru' the driver. We experimented with it and it does work. Here's the url: http://support.microsoft.com/support/kb/articles/Q154/0/78.asp

    --
    Doctors destroy health, lawyers destroy justice, universities destroy knowledge, religion destroys spirituality
  22. Consider WSH if you want a simple web GUI by wiredlogic · · Score: 2, Interesting

    You could consider VB Script and HTML wrapped into a WSH file if you want a simple web GUI and being locked to IE isn't a problem.

    --
    I am becoming gerund, destroyer of verbs.
  23. Dont take my stappler. by TiggertheMad · · Score: 2, Funny

    I am working on a project that would allow our customers to test our sending different PCL commands to LAN printers.

    I will be looking forward to the first error is encountered by a user. You will hear someone in the cubical farm say, "PCL PC Load letter? What the fuck is PCL PC Load letter?!?"

    --

    HA! I just wasted some of your bandwidth with a frivolous sig!
  24. Autohotkey by gad_zuki! · · Score: 2, Interesting

    I guess everyone has their favorite scripting language and I'm sure Powershell is awesome, but it came 10 years too late. I'm personally fond of Autohotkey. Its a decent scripting language, has lots of handy built in functions, and is easy to pick up, especially for those of us who don't code everyday. I'm always a little surprised at how much it can do. I've used it to manipulate installers with no command line options by using the built in functions to grab the GUI window, press buttons, etc. Most everything it can't do I can do in Windows by putting the unixutils on a share and just calling them via the script. Granted, its a work-around but it works for me.

  25. Re:If It Works, It Works But Remember Your Custome by Barny · · Score: 2, Funny

    Wizard? Pfft!

    He needs to re-implement Clippy!

    Think of how helpful this would be :)

    --
    ...
    /me sighs
  26. Powershell or VB Script w/ hta by KevMar · · Score: 5, Informative

    I would also look to Powershell to solve his issue.

    Before Powershell, I would have went with VB Script.

    Because he was wanting a bit more of a GUI, HTA (HTML Application) would be a simple option. It is a local web page named .hta instead of .html and it runs with application security on the local computer. Any script you can put in a .vbs file, you can also put into a script block of a .hta. This is one of those little tricks that not to many people know about.

    I use hta when I want to keep the flexibility of html/script as an alternative to a compiled vb.net app.

    --
    Im a gamer, not a grammer major. This post is full of spelling and grammer mistakes.
  27. Re:Is it pronounced DOHS or DAHS? by AgentPhunk · · Score: 3, Funny

    The other posters are correct. You only say "DAHS" if you're from Boston, as in: "Oh My Gawhd, some retahd on slashdaht is still writing DAHS bahtch files. Why don't we just fihre up Windows fah Workgroups while we're aht it."

    Seriously though - I think nmap can send PCL commands via the nmap scripting engine, which is written in LUA. How about wrapping that with what some of the other posters are suggesting?

  28. Re:Ruby or Python by MaskedSlacker · · Score: 2, Funny

    That's me Perl hardcore programmer saying.

    If your Perl code is anything like your sentences...oh, who am I kidding, it would still make more sense than MY Perl code.

  29. Re:Better Alternatives to DOS Batch Files? by EvanED · · Score: 2, Funny

    You can use bash on most Linux implementations

    You're in luck: there is something better than being a trolling twat making useless suggestions. It's called "sticking your head in a vise."

    What you do is get a vise, you put your head in it, and you twist the handle until it contacts both sides of your head. At this point you'll really have to turn the handle hard, but keep going.

    You can stick your head in a vise in most wood shops.

  30. Re:Ruby or Python by bsDaemon · · Score: 2, Funny

    I write Perl largely like I learned to write C, so its very readable, though perhaps not particularly idiomatic.

  31. Re:Is it pronounced DOHS or DAHS? by omnichad · · Score: 2, Funny

    woorsh?

  32. Re:As a perl geek I have to say... by Smallpond · · Score: 2, Informative

    http://search.cpan.org/~karasik/Win32-GuiTest-1.56/lib/Win32/GuiTest.pm

    Perl has plenty of Windows-specific modules made for this type of application.

  33. size matters by Eth1csGrad1ent · · Score: 3, Funny

    Yeah. VB, C++, Java, they all do PCL commands.

    ..but will it fit on a floppy ??

  34. Re:Is it pronounced DOHS or DAHS? by Anonymous Coward · · Score: 3, Funny

    I never heard anyone say it.

    Ugh. Now I feel old. Screw you, AC.

  35. LabVIEW by CaptainPhoton · · Score: 2, Informative

    Most electronics companies where I've worked or consulted use LabVIEW for automated product testing.

    You can download an eval copy from http://www.ni.com/labview/optin/trylabview

    LabVIEW is graphical programming. I'm still loyal to C/C++, but all those text languages are so 20th century! ;) Until we achieve natural language programming, LabVIEW is as good as it gets for 21st century.

    Putting humor aside, LabVIEW apps are very simple to write and deploy. The Application Builder allows you to create an EXE from your app and bundle it with the runtime in a nice Windows installer that you can send to your customers.

    I've seen some suggestions on here for PowerShell. One limitation of DOS batch files is the inability to interact directly with .NET. Anyone on modern Windows should learn .NET since it is the preferred framework now for that OS. PowerShell can give you the .NET access, but LabVIEW will have a much quicker learning curve if you ever have the urge to delve into .NET.

    The LabVIEW forums are very active, and the community gurus provide quick turnaround on support questions. For long-term maintenance of your test app, you're likely to find more engineers in the Test&Measurement arena that use LabVIEW versus DOS.

    Good luck in your choices!

  36. LoveDOS by JimWise · · Score: 2, Interesting

    A "friend" of mine used to always stick a copy of LoveDOS on anyone's computer in college that was left unattended. The ending comment of "Call me crazy but I love DOS" brought these "fond" memories back. It looks like someone has actually archived a copy of it, as well as putting together some screen shots and info about it: http://jeff.rainbow-100.com/?p=100 Ever since being inflicted with LoveDOS I have set up every computer I own to use a BIOS password.

  37. Re:If you do use VB... (Don't do that!) by Will.Woodhull · · Score: 2, Insightful

    Ouch! Last thing needed when distributing printer test code is another wrapper layer that could interfere with printing.

    Except maybe an additional patch to turn off the additional wrapper layer, assuming it actually does that completely, every time no matter what... maybe that is really the last thing needed.

    If .bat files won't do it for you, then you could look into the Windows implementation of Perl, coupled with the Tcl/Tk module, which gives you basic GUI support so you can fancy it up with buttons and input boxes and such. After you've got the script working right, you can run it through Perl2Exe or one of the other available compilers and distribute your work as a .exe file. This has two obvious advantages:

    1. a .exe file looks a helluvalot more impressive than a .bat file
    2. you won't need to worry about someone messing around in your .bat and causing you needless support headaches.

    A very important side effect is that you'd gain a little experience with Perl, which can work scripting wonders that .bat files could never do.

    Sort of a caveat: I once made my living by writing simple perl scripts that pulled data from the text dumps of a legacy MUMPS database and returned .csv files that the QA guys could play with in Excel. So I'm biased. I've also left the Microsoft ecosystem for Linux, since I think the Microsoft ecosystem is terminally polluted on its own effluvium. So I'm really, really biased. (Perl is FOSS originating in the Unix/Linux world; Perl2Exe is shareware that I remember cost under $50)

    --
    Will
  38. Another vote for Python by Just+Brew+It! · · Score: 2, Informative

    Where I work, we have used Python to create a regression and qualification testing framework for embedded avionics software. It has worked out exceptionally well. The testing framework was originally developed on Windows, but we are also porting it to Linux. (The Python parts are completely portable, of course... but because of the nature of the application we also had to create libraries in C to drive some specialized hardware, and the C modules do require some porting effort.)