Skip to content

Commit 7e78430

Browse files
authored
Create splitCommand.bat
1 parent 00a8ab0 commit 7e78430

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@echo off
2+
3+
:: https://stackoverflow.com/a/64752041/388389
4+
:: Splits a long command into a few lines.
5+
:: Limitations are that some special symbols should be escaped (carets, closing brackets and etc.)
6+
7+
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
8+
set "{{=setlocal enableDelayedExpansion&for %%a in (" & set "}}="::end::" ) do if "%%~a" neq "::end::" (set command=!command! %%a) else (call !command! & endlocal)"
9+
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
10+
11+
:: Example:
12+
13+
%{{%
14+
echo
15+
"command"
16+
written
17+
on a
18+
few lines
19+
%}}%

0 commit comments

Comments
 (0)