Skip to content

Instantly share code, notes, and snippets.

@Elrashid
Last active August 14, 2019 01:18
Show Gist options
  • Save Elrashid/60bc95bd5d2d4157f1bad113f89bc2d9 to your computer and use it in GitHub Desktop.
Save Elrashid/60bc95bd5d2d4157f1bad113f89bc2d9 to your computer and use it in GitHub Desktop.
dotnet_new_mvc.bat

dotnet New MVC App Script

Note

this script has dependency on

https://gist.githubusercontent.com/Elrashid/ce59f52d5552f453e4249d26e67a48c0/raw/.gitignore

Step 01

We will open a Run window

On the keybord press

Windoes Key + R

wait

Step 02

We will open a cmd Window

On the Run window text-Input write

cmd

on the Keybord press

Enter

Step 03

We will make a directory and make it the working directory for our cmd

On the CMD Window write

cd /d D:\Projects\P.IT.Support\asp.net

Step 04

We will download and run the script

On the CMD Window write

set scriptUrl="https://gist.githubusercontent.com/Elrashid/60bc95bd5d2d4157f1bad113f89bc2d9/raw/dotnet_new_mvc.bat"

PowerShell -Command "(new-object System.Net.WebClient).DownloadFile('%scriptUrl%','dotnet_new_mvc.bat')"

dotnet_new_mvc.bat
co_elrashid_app
echo off
cls
SET projectName=
SET /p projectName="Enter a you project Name ( ex: for co.elrashid.app use co_elrashid_app ) : "
IF NOT DEFINED projectName GOTO :EOF
SET HUB_PROTOCOL=ssh
SET /p HUB_PROTOCOL="Use one of https|ssh|git as preferred protocol for git clone/push. or leave emty for %HUB_PROTOCOL% :"
IF NOT DEFINED HUB_PROTOCOL GOTO :EOF
SET GITHUB_ORGANIZATION=elrashid-flutter-examples
SET /p GITHUB_ORGANIZATION="Enter a your GITHUB ORGANIZATION/ USERNAME or leave emty for %GITHUB_ORGANIZATION% :"
IF NOT DEFINED GITHUB_ORGANIZATION GOTO :EOF
SET canceled=y
SET /p canceled=" so project Name is %projectName% and remote is %GITHUB_ORGANIZATION%/%projectName% using %HUB_PROTOCOL% protocol ? c(cancel) or Enter to continue : "
IF %canceled%==c echo cancelled
IF %canceled%==c GOTO :EOF
echo continue with project %projectName%
call dotnet.mvc.setup.2.bat
dotnet new mvc -o %projectName%
cd %projectName%
echo dotnet run >run.app.bat
copy /Y NUL git.init.bat
echo Set HUB_PROTOCOL=%HUB_PROTOCOL% >> git.init.bat
echo git init >> git.init.bat
echo git add . ^&^& git commit -m "initial files" >> git.init.bat
REM echo hub create %GITHUB_ORGANIZATION%/%curr_dir_name% >> git.init.bat
echo hub create %GITHUB_ORGANIZATION%/%projectName% >> git.init.bat
echo git push --set-upstream origin master >> git.init.bat
copy /Y NUL git.add.commit.push.bat
echo SET myCommitMessage=initial files >> git.add.commit.push.bat
echo SET /p myCommitMessage="Enter a your Commit Message or leave emty for %%myCommitMessage%% :" >> git.add.commit.push.bat
echo git add . ^&^& git commit -m "%%myCommitMessage%%" >> git.add.commit.push.bat
echo git push origin master >> git.add.commit.push.bat
set scriptUrl="https://gist.githubusercontent.com/Elrashid/ce59f52d5552f453e4249d26e67a48c0/raw/.gitignore"
PowerShell -Command "(new-object System.Net.WebClient).DownloadFile('%scriptUrl%','.gitignor')"
call git.init.bat
del git.init.bat
cd ..
PowerShell -Command "(new-object System.Net.WebClient).DownloadFile('https://gist.githubusercontent.com/Elrashid/60bc95bd5d2d4157f1bad113f89bc2d9/raw/dotnet.mvc.setup.1.bat','dotnet.mvc.setup.1.bat')"
PowerShell -Command "(new-object System.Net.WebClient).DownloadFile('https://gist.githubusercontent.com/Elrashid/60bc95bd5d2d4157f1bad113f89bc2d9/raw/dotnet.mvc.setup.2.bat','dotnet.mvc.setup.2.bat')"
REM call dotnet.mvc.setup.1.bat
REM del dotnet.mvc.setup.1.bat
REM del dotnet.mvc.setup.2.bat
(goto) 2>nul & del "%~f0" & EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment