change writeBat to writeScript & add of unix compatibility