将下面的代码拷贝到文本文件中,重命名文件为 cocos3.0创建工程.bat
@echo off echo -------------------------create project with python----------------------------- set /p project_name= "Please enter your project name [for example: Runner] : " echo --------your project name : %project_name% set /p package_name= "Please enter your package name [for example: com.firedragonpzy.roy ] : " echo --------your package name : %package_name% set /p language_type= "Please enter your language types [cpp | javascript | lua] : " echo --------your language types : %language_type% set directory_path=e:cocoSample echo --------your project directory : %directory_path% set temp_path= oolscocos2d-consolein set project_path=%cd%%temp_path% cd %project_path% ::E:cocos2d-x-3.0cocos2d-x-3.0 oolscocos2d-consoleincocos.py 0.2 - cocos console: A command line tool for cocos2d ::Available commands: :: compile Compiles the current project to binary :: new Creates a new project :: run Compiles & deploy project and then runs it on the target :: jscompile minifies and/or compiles js files :: deploy Deploy a project to the target ::Example: :: E:cocos2d-x-3.0cocos2d-x-3.0 oolscocos2d-consoleincocos.py new --help :: E:cocos2d-x-3.0cocos2d-x-3.0 oolscocos2d-consoleincocos.py run --help ::E:cocos2d-x-3.0cocos2d-x-3.0 oolscocos2d-consolein>cocos.py new --help :: usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY] [-t TEMPLATE_NAME] [--no-native] [PROJECT_NAME] :: Creates a new project :: positional arguments: PROJECT_NAME Set the project name :: optional arguments: :: -h, --help show this help message and exit :: -p PACKAGE_NAME, --package PACKAGE_NAME :: Set a package name for project :: -l {cpp,lua,js}, --language {cpp,lua,js} :: Major programming language you want to use, should be [cpp | lua | js] :: -d DIRECTORY, --directory DIRECTORY :: Set generate project directory for project :: -t TEMPLATE_NAME, --template TEMPLATE_NAME :: Set the template name you want create from ::lua/js project arguments: :: --no-native No native support. set temp_path=cocos.py new -p %package_name% -l %language_type% -d %directory_path% %project_name% set last=%project_path%%temp_path% %last% pause
将这个bat文件放在工程的根目录中,同时修改
set directory_path=e:cocoSample
这一句中生成的工程路径为自己的工程路径
哈哈,以后就不用在输入繁琐的命令了