Last active
November 8, 2020 21:01
-
-
Save EmilienLeroy/6290617400732139a948e25004d263bc to your computer and use it in GitHub Desktop.
Script Manager (Windows)
This file contains 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 | |
rem simple script for c++ project. | |
rem run dev | |
rem compile the project, run it and delete it after execution. | |
IF "%1"=="dev" g++ main.cpp -o app & app.exe & del app.exe & goto exit | |
rem run build | |
rem compile prodution exe. | |
IF "%1"=="build" g++ main.cpp -o app & goto exit | |
:exit |
This file contains 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
# This script will execute command from 'script.json' file | |
# ./run.ps1 dev | |
# see the script.json | |
param([string] $cmd); | |
$script = (Get-Content 'script.json' | Out-String | ConvertFrom-Json); | |
$execs = $script."$cmd" -split "&"; | |
Foreach($exec in $execs) | |
{ | |
try { | |
Invoke-Expression -Command $exec; | |
} catch { | |
Write-Host "An error occurred." | |
} | |
} |
This file contains 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
{ | |
"dev": "g++ main.cpp -o app & ./app.exe & del ./app.exe", | |
"build": "g++ main.cpp -o app" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment