Make this a class or a function so that batch can call it directly and not through the shell.