Don't put *.java, you need to replace this with the actual file name.
rem this will compile a file named test.java
javac test.java
There are also various parameters you will need to consider when building via command-line. I won't go into the details for each one, but these are the main ones:
1. Multiple source files
2. packages/multiple packages, nested packages
3. external libraries.
You can also pass in command-line arguments for batch files. I can't remember the exact semantic, but I believe it's something like this:
rem this is build.bat
rem this will compile a file named specified in the first parameter
javac %1
Then, to use this batch file: