I am a Software Development Engineer in Test working for the Windows Sound team. You can contact me via email: mateer at microsoft dot com
Friend key: 28904932216450_59cd9d55374be03d8167d37c8ff4196b
Stealing from XKCD again:
I have a similar problem with North and South. On the globe, there's a clearly marked "North Pole" and a clearly marked "South Pole."
Fine.
Magnets also have North and South poles. These are typically labeled N and S respectively. Fine.
But if you consider the Earth as a large magnet (which it is), then you have to stick the N where the penguins live (Antarctica-ish) and the S where the polar bears live (Canada-ish...)
That bugs me.
Like many programmers, I've messed around in a lot of development environments - including the UNIX/Linux family of operating systems.
One of the UNIX commands I like is xargs... this is very handy when writing one-off command lines or scripts.
I like it so much that I miss it terribly when I'm in a Windows OS. So I wrote an xargs.bat and stuck it in my PATH. Now instead of writing complicated for loops, I can just pipe to xargs.
The script is "powered by" the highlighted line:
C:\Users\MatEer\Desktop\custom-path>type xargs.bat@echo offsetlocalif /i (%1)==(/?) goto USAGEif /i (%1)==() goto USAGEif /i (%1)==(/addquotes) goto ADDQUOTESgoto NOQUOTES:USAGEecho usage: something-that-produces-output ^| %0 [/?] [/addquotes] thing-to-runecho xargs.bat by Matthew van Eerde 10/3/2005echo.echo something-that-produces-output should write to its STDOUTecho thing-to-run will have each line of the output appended to it,echo then will be run successivelyecho.echo If /addquotes is set, quotes will be added around the lineecho before appending the line to thing-to-runecho.echo If you call xargs without piping output to it, xargs will waitecho for you to type something in on STDIN.echo Ctrl-Z on its own line to finish.goto END:ADDQUOTESrem eat /addquotes parametershiftrem Alas, shift doesn't affect %*if (%1)==() goto USAGEset basecommand=%1shift:BUILDBASECOMMANDif (%1)==() goto DONEBASECOMMANDset basecommand=%basecommand% %1shiftgoto BUILDBASECOMMAND:DONEBASECOMMANDrem run the program specified by %*rem as many times as there are lines in STDINrem with one extra argument -- defined by each line of STDIN -- in quotesremrem all that the find command does is intercept STDINremfor /F "usebackq delims=" %%a in (`find /v ""`) do %basecommand% "%%a"goto END:NOQUOTESrem run the program specified by %*rem as many times as there are lines in STDINrem with extra arguments defined by each line of STDINremrem all that the find command does is intercept STDINremfor /F "usebackq delims=" %%a in (`find /v ""`) do call %* %%agoto END:ENDendlocal
This allows wonderfully anaOStic things like findstr /m IFoo * | xargs start