Created
November 28, 2017 23:24
-
-
Save JohannesMP/6f81e7daa1f9d84ca5531f562cc7ea33 to your computer and use it in GitHub Desktop.
Using a batch file's name to pass in an argument
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 | |
setlocal | |
setlocal EnableDelayedExpansion | |
SET filename=%~n0 | |
SET delim=- | |
SET port=!filename:*%delim%=! | |
echo PORT: %port% | |
rem example: running jekyll with a given port | |
rem start "JEKYLL" bundle exec jekyll serve --port=%port% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment