John Croson's Blog Home: Subsystem for Unix-based Applications and Windows Batch scripts

Wednesday, September 08, 2010

Subsystem for Unix-based Applications and Windows Batch scripts

The current logo of Microsoft Windows, the com...Image via WikipediaSome time ago, I installed the SUA package with the thought I might use it for scripting and other tasks that I find easier to accomplish using GNU-like tools rather than Windows.

Recently I needed to run a batch script that programatically checks for the evidence of some data files and injects them into MS Sql via DTS. This script worked fine on another server for years with a few tweaks now and then, and suddenly during my tests on this machine, it was failing.

What I found was that my script was using the Windows FIND command, which is also installed by SUA. When I used FIND in my script, it was using the SUA flavor, and not the Windows version.

I checked my PATH environment and saw that SUA's path was listed first, then %SystemRoot%, and %SystemRoot%\System32 where Windows FIND is installed. If I were a betting man, I'd have to say that since the SUA tools are listed before Windows, they get processed first. I've not tested this, but really didn't feel the need to since calling the application absolutely in the script (%WINDIR%\System32\Find.exe) solves my problem.

Hope this helps you!

Enhanced by Zemanta

No comments: