I am running Tomcat as an NT service. How do I write a command file or a batch file that should run a Java class (or a jar file) and restart the Tomcat service (so that the java class results can take effect)?

Michael Lantzen

You can do a youscript.cmd file and put 4 lines into it

cd directorywithYourClass
java YourClass
net stop Tomcat
net start Tomcat

that's it, assuming that you named your service Tomcat.