“pipe xargs” in DOS
January 4th, 2007Anyone who works with files knows that the unix CLI is the undisputed champion. Though, I frequently work with customers who use Windows exclusively and don’t have the interest or permission to install tools like GnuWin32 or cygwin. In this case and especially when troubleshooting, I’ve found the following trick to emulate “pipe xargs” when manipulating or running a command on sets of files.
- UNIX:
- find . -name “*.java” | xargs accurev keep -c “comment”
- DOS:
- dir /s /b *.java > javafiles.txt
- FOR /F %k in (javafiles.txt) DO accurev keep -c “comment” %k
As one would expect, it takes 2 lines in DOS to produce the same effect in Unix… but I digress. At least the “pipe xargs” can be emulated with relatively minimal effort in DOS.





