Thanks for the reply. How can I include "call setEnv.bat" inside a subroutine of perl - the pl2bat sure generated a .bat file, but the subroutines are still subroutines right? Can I just stick in a statement "call setEnv.bat" inside a subroutine in the generated bat file?