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."
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.
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)
Its a great tool thats free, and has good GUI and has good scripting capabilities too:
http://www.autoitscript.com/autoit3/index.shtml
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!
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 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.
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.
It was extended to 8.00 by Luchezar Georgiev[1], and supports REXX interpreter, including free ones[2].
[1] http://www.4dos.info/
[2] http://www.4dos.info/dalter.htm#08
DOS sounds like "Boss" not like "dose".
Give me Classic Slashdot or give me death!
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.
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.
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
Doctors destroy health, lawyers destroy justice, universities destroy knowledge, religion destroys spirituality
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.
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.
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.
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.
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.
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.
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!
Use VBScript, not that complicated to pick up by looking at examples and RTM'ing the help file. Then use a HTA to present the interface, and even take feedback inside the HT
http://technet.microsoft.com/en-us/scriptcenter/dd742317.aspx
http://www.microsoft.com/downloads/details.aspx?familyid=01592c48-207d-4be1-8a76-1c4099d7bbb9&displaylang=en
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.)