需要两个BAT文件
1-Folder.bat
@ECHO OFF title=Create Mongodb Folder md c:MongoDBdatadb md c:MongoDBlog ECHO. >c:MongoDBlogmongo.log PAUSE
2-Mongodb.bat
@echo off title=Run Mongodb Command start cmd /k "cd c:MongoDBin && mongod --dbpath C:MongoDBdatadb --logpath=C:MongoDBlogmongodb.log --logappend --install --serviceName ""MongoDB"" && taskkill /f /t /im cmd.exe" PAUSE