The code 'use dbname' will not operate in scripted mode. What you can do is to explicitly specify the database in the connection.
And also, you can generate a connection within a script, refer the following code:
db2 = connect("server:27017/otherdbname")
You have to save the following code in stop_mongod.js file:
db = connect("localhost:27017/admin");
db.shutdownServer();
quit();
If needed you can adjust the connection string. Then from the batch script, run the following command:
mongo stop_mongod.js
If you are a beginner and want to know more about MongoDB, then do check out the MongoDB tutorial which will help you in learning MongoDB from scratch.