Using "ls" in Windows
As my professional life moves into a more UNIX direction I have found myself more and more often trying to execute UNIX commands in Windows. One such command is "ls" - to list the contents of a directory. I know that cygwin binaries can be compiled for Windows to get ls functionality, but I decided to solve the problem a different way. I've written a batch file that wraps the "dir" command in windows. To work properly, both "ls.bat" and "getstrlen.bat" from an earlier post on this blog, will need to be present in your PATH. I don't have time to explain this code right now, but I will make an effort if anyone asks. ls.bat: @echo off if not "%1"=="" goto gotargs echo Executing: dir /b&dir /b goto done :gotargs set ARGS1=%1 set CHECK=%ARGS1:~0,1% if "%CHECK%"=="-" (set CURROPT=%ARGS1% & goto parsearg1) if not "%9"=="" (echo Executing: dir /b "%1 %2 %3 %4 %5 %6 %7 %8