Skip to content

Instantly share code, notes, and snippets.

@JohannesMP
Created November 28, 2017 23:24
Show Gist options
  • Save JohannesMP/6f81e7daa1f9d84ca5531f562cc7ea33 to your computer and use it in GitHub Desktop.
Save JohannesMP/6f81e7daa1f9d84ca5531f562cc7ea33 to your computer and use it in GitHub Desktop.
Using a batch file's name to pass in an argument
@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