Last active
December 23, 2015 23:29
-
-
Save jacksonfdam/6710742 to your computer and use it in GitHub Desktop.
A windows batch file to automate my tasks with projects.
Just save in yours project server root and run in comand line: newproject.bat www.myproject.com I use EasyPHP, but feel free to customize the script and share.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF & setLocal enabledelayedexpansion | |
TITLE CREATE A NEW PROJECT | |
COLOR F0 | |
::location of vhosts | |
SET BASEURL=E:\www\ | |
SET WINBASEURL=E:/www/ | |
IF %1.==. GOTO No1 | |
IF EXIST %BASEURL%%1 ECHO The specified site folder already exists! Choose another. | |
IF EXIST %BASEURL%%1 GOTO No1 | |
SET NEWLINE=^& ECHO. | |
FIND /C /I "%1" %WINDIR%\system32\drivers\etc\hosts | |
:: IF %ERRORLEVEL% NEQ 0 ECHO %NEWLINE%>>%WINDIR%\system32\drivers\etc\hosts | |
:: IF %ERRORLEVEL% NEQ 0 ECHO 127.0.0.1 %1>>%WINDIR%\system32\drivers\etc\hosts | |
ECHO %NEWLINE%>>%WINDIR%\system32\drivers\etc\hosts | |
ECHO 127.0.0.1 %1>>%WINDIR%\system32\drivers\etc\hosts | |
ECHO %NEWLINE%>>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE%#%1# >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE%^<VirtualHost %1^> >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE% DocumentRoot "%WINBASEURL%%1" >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE% ServerName %1 >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE% ServerAlias %1 >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE% ^<Directory "%WINBASEURL%%1"^> >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE% Options Indexes FollowSymLinks Includes ExecCGI >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE% Order allow,deny >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE% Allow from all >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE% ^</Directory^> >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
ECHO %NEWLINE% ^</VirtualHost^> >>"C:\Program Files\EasyPHP-5.3.9\conf_files\httpd.conf" | |
GOTO End1 | |
:No1 | |
ECHO No param sitename | |
GOTO End1 | |
:End1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment