Thursday, 28 May 2009

Windows not so bad after all?

This post is for my distinguished hacker colleague Stefan Z. Do you remember how we were always complaining that you cannot do any serious development on Windows, as the following standard Unix command line isn't posible?
    cat out.txt | grep ERROR
Well, as I'm doing Windows programming now, I recently found out that it's possible after all! Incredible but true! Hovever the syntax is somehow different:
    type out.txt | findstr ERROR
On things like that I see how fast the time is passing! A couple of years before, I'd never believe that Windows would ever catch on. I think, the tide change came with XP.

But wait, it comes even better! Here's a script for checking if a process is running and killing it if so:

   tasklist /FI "IMAGENAME eq myProcess.exe" | findstr myProcess.exe

echo "-- kill running myProcess"
taskkill /F /IM myProcess.exe

echo "-- starting the XXX process"
Even a sleep is possible (athough it's arguably very ugly):
    @ping -n 2 -w 1000 > nul

And here (in the IT-Dojo) you can see that the Windows command promtp has some interesting history mechanisms!

1 comment:

Stefan said...

IMHO, you can use each opereting system as a development platform today. So my comments from the past are not valid anymore... :-)