{"name":"Batch File","scopeName":"source.batchfile","patterns":[{"include":"#commands"},{"include":"#comments"},{"include":"#constants"},{"include":"#controls"},{"include":"#escaped_characters"},{"include":"#labels"},{"include":"#numbers"},{"include":"#operators"},{"include":"#parens"},{"include":"#strings"},{"include":"#variables"}],"repository":{"command_set":{"patterns":[{"begin":"(?\u003c=^|[\\s@])(?i:SET)(?=$|\\s)","end":"(?=$\\n|[\u0026|\u003e\u003c)])","patterns":[{"include":"#command_set_inside"}],"beginCaptures":{"0":{"name":"keyword.command.batchfile"}}}]},"command_set_group":{"patterns":[{"begin":"\\(","end":"\\)","patterns":[{"include":"#command_set_inside_arithmetic"}],"beginCaptures":{"0":{"name":"punctuation.section.group.begin.batchfile"}},"endCaptures":{"0":{"name":"punctuation.section.group.end.batchfile"}}}]},"command_set_inside":{"patterns":[{"include":"#escaped_characters"},{"include":"#variables"},{"include":"#numbers"},{"include":"#parens"},{"include":"#command_set_strings"},{"include":"#strings"},{"begin":"([^ ][^=]*)(=)","end":"(?=$\\n|[\u0026|\u003e\u003c)])","patterns":[{"include":"#escaped_characters"},{"include":"#variables"},{"include":"#numbers"},{"include":"#parens"},{"include":"#strings"}],"beginCaptures":{"1":{"name":"variable.other.readwrite.batchfile"},"2":{"name":"keyword.operator.assignment.batchfile"}}},{"name":"meta.expression.set.batchfile","begin":"\\s+/[aA]\\s+","end":"(?=$\\n|[\u0026|\u003e\u003c)])","patterns":[{"name":"string.quoted.double.batchfile","begin":"\"","end":"\"","patterns":[{"include":"#command_set_inside_arithmetic"},{"include":"#command_set_group"},{"include":"#variables"}],"beginCaptures":{"0":{"name":"punctuation.definition.string.begin.batchfile"}},"endCaptures":{"0":{"name":"punctuation.definition.string.end.batchfile"}}},{"include":"#command_set_inside_arithmetic"},{"include":"#command_set_group"}]},{"begin":"\\s+/[pP]\\s+","end":"(?=$\\n|[\u0026|\u003e\u003c)])","patterns":[{"include":"#command_set_strings"},{"name":"meta.prompt.set.batchfile","begin":"([^ ][^=]*)(=)","end":"(?=$\\n|[\u0026|\u003e\u003c)])","patterns":[{"include":"#strings"}],"beginCaptures":{"1":{"name":"variable.other.readwrite.batchfile"},"2":{"name":"keyword.operator.assignment.batchfile"}}}]}]},"command_set_inside_arithmetic":{"patterns":[{"include":"#command_set_operators"},{"include":"#numbers"},{"name":"punctuation.separator.batchfile","match":","}]},"command_set_operators":{"patterns":[{"match":"([^ ]*)(\\+\\=|\\-\\=|\\*\\=|\\/\\=|%%\\=|\u0026\\=|\\|\\=|\\^\\=|\u003c\u003c\\=|\u003e\u003e\\=)","captures":{"1":{"name":"variable.other.readwrite.batchfile"},"2":{"name":"keyword.operator.assignment.augmented.batchfile"}}},{"name":"keyword.operator.arithmetic.batchfile","match":"\\+|\\-|/|\\*|%%|\\||\u0026|\\^|\u003c\u003c|\u003e\u003e|~"},{"name":"keyword.operator.logical.batchfile","match":"!"},{"match":"([^ =]*)(=)","captures":{"1":{"name":"variable.other.readwrite.batchfile"},"2":{"name":"keyword.operator.assignment.batchfile"}}}]},"command_set_strings":{"patterns":[{"name":"string.quoted.double.batchfile","begin":"(\")\\s*([^ ][^=]*)(=)","end":"\"","patterns":[{"include":"#variables"},{"include":"#numbers"},{"include":"#escaped_characters"}],"beginCaptures":{"1":{"name":"punctuation.definition.string.begin.batchfile"},"2":{"name":"variable.other.readwrite.batchfile"},"3":{"name":"keyword.operator.assignment.batchfile"}},"endCaptures":{"0":{"name":"punctuation.definition.string.end.batchfile"}}}]},"commands":{"patterns":[{"name":"keyword.command.batchfile","match":"(?\u003c=^|[\\s@])(?i:adprep|append|arp|assoc|at|atmadm|attrib|auditpol|autochk|autoconv|autofmt|bcdboot|bcdedit|bdehdcfg|bitsadmin|bootcfg|brea|cacls|cd|certreq|certutil|change|chcp|chdir|chglogon|chgport|chgusr|chkdsk|chkntfs|choice|cipher|clip|cls|clscluadmin|cluster|cmd|cmdkey|cmstp|color|comp|compact|convert|copy|cprofile|cscript|csvde|date|dcdiag|dcgpofix|dcpromo|defra|del|dfscmd|dfsdiag|dfsrmig|diantz|dir|dirquota|diskcomp|diskcopy|diskpart|diskperf|diskraid|diskshadow|dispdiag|doin|dnscmd|doskey|driverquery|dsacls|dsadd|dsamain|dsdbutil|dsget|dsmgmt|dsmod|dsmove|dsquery|dsrm|edit|endlocal|eraseesentutl|eventcreate|eventquery|eventtriggers|evntcmd|expand|extract|fc|filescrn|find|findstr|finger|flattemp|fonde|forfiles|format|freedisk|fsutil|ftp|ftype|fveupdate|getmac|gettype|gpfixup|gpresult|gpupdate|graftabl|hashgen|hep|helpctr|hostname|icacls|iisreset|inuse|ipconfig|ipxroute|irftp|ismserv|jetpack|klist|ksetup|ktmutil|ktpass|label|ldifd|ldp|lodctr|logman|logoff|lpq|lpr|macfile|makecab|manage-bde|mapadmin|md|mkdir|mklink|mmc|mode|more|mount|mountvol|move|mqbup|mqsvc|mqtgsvc|msdt|msg|msiexec|msinfo32|mstsc|nbtstat|net computer|net group|net localgroup|net print|net session|net share|net start|net stop|net use|net user|net view|net|netcfg|netdiag|netdom|netsh|netstat|nfsadmin|nfsshare|nfsstat|nlb|nlbmgr|nltest|nslookup|ntackup|ntcmdprompt|ntdsutil|ntfrsutl|openfiles|pagefileconfig|path|pathping|pause|pbadmin|pentnt|perfmon|ping|pnpunatten|pnputil|popd|powercfg|powershell|powershell_ise|print|prncnfg|prndrvr|prnjobs|prnmngr|prnport|prnqctl|prompt|pubprn|pushd|pushprinterconnections|pwlauncher|qappsrv|qprocess|query|quser|qwinsta|rasdial|rcp|rd|rdpsign|regentc|recover|redircmp|redirusr|reg|regini|regsvr32|relog|ren|rename|rendom|repadmin|repair-bde|replace|reset session|rxec|risetup|rmdir|robocopy|route|rpcinfo|rpcping|rsh|runas|rundll32|rwinsta|sc|schtasks|scp|scwcmd|secedit|serverceipoptin|servrmanagercmd|serverweroptin|setspn|setx|sfc|sftp|shadow|shift|showmount|shutdown|sort|ssh|ssh-add|ssh-agent|ssh-keygen|ssh-keyscan|start|storrept|subst|sxstrace|ysocmgr|systeminfo|takeown|tapicfg|taskkill|tasklist|tcmsetup|telnet|tftp|time|timeout|title|tlntadmn|tpmvscmgr|tpmvscmgr|tacerpt|tracert|tree|tscon|tsdiscon|tsecimp|tskill|tsprof|type|typeperf|tzutil|uddiconfig|umount|unlodctr|ver|verifier|verif|vol|vssadmin|w32tm|waitfor|wbadmin|wdsutil|wecutil|wevtutil|where|whoami|winnt|winnt32|winpop|winrm|winrs|winsat|wlbs|wmic|wscript|wsl|xcopy)(?=$|\\s)"},{"begin":"(?i)(?\u003c=^|[\\s@])(echo)(?:(?=$|\\.|:)|\\s+(?:(on|off)(?=\\s*$))?)","end":"(?=$\\n|[\u0026|\u003e\u003c)])","patterns":[{"include":"#escaped_characters"},{"include":"#variables"},{"include":"#numbers"},{"include":"#strings"}],"beginCaptures":{"1":{"name":"keyword.command.batchfile"},"2":{"name":"keyword.other.special-method.batchfile"}}},{"match":"(?i)(?\u003c=^|[\\s@])(setlocal)(?:\\s*$|\\s+(EnableExtensions|DisableExtensions|EnableDelayedExpansion|DisableDelayedExpansion)(?=\\s*$))","captures":{"1":{"name":"keyword.command.batchfile"},"2":{"name":"keyword.other.special-method.batchfile"}}},{"include":"#command_set"}]},"comments":{"patterns":[{"begin":"(?:^|(\u0026))\\s*(?=((?::[+=,;: ])))","end":"\\n","patterns":[{"name":"comment.line.colon.batchfile","begin":"((?::[+=,;: ]))","end":"(?=\\n)","beginCaptures":{"1":{"name":"punctuation.definition.comment.batchfile"}}}],"beginCaptures":{"1":{"name":"keyword.operator.conditional.batchfile"}}},{"name":"comment.line.rem.batchfile","begin":"(?\u003c=^|[\\s@])(?i)(REM)(\\.)","end":"(?=$\\n|[\u0026|\u003e\u003c)])","beginCaptures":{"1":{"name":"keyword.command.rem.batchfile"},"2":{"name":"punctuation.separator.batchfile"}}},{"name":"comment.line.rem.batchfile","begin":"(?\u003c=^|[\\s@])(?i:rem)\\b","end":"\\n","patterns":[{"name":"invalid.illegal.unexpected-character.batchfile","match":"[\u003e\u003c|]"}],"beginCaptures":{"0":{"name":"keyword.command.rem.batchfile"}}}]},"constants":{"patterns":[{"name":"constant.language.batchfile","match":"\\b(?i:NUL)\\b"}]},"controls":{"patterns":[{"name":"keyword.control.statement.batchfile","match":"(?i)(?\u003c=^|\\s)(?:call|exit(?=$|\\s)|goto(?=$|\\s|:))"},{"match":"(?\u003c=^|\\s)(?i)(if)\\s+(?:(not)\\s+)?(exist|defined|errorlevel|cmdextversion)(?=\\s)","captures":{"1":{"name":"keyword.control.conditional.batchfile"},"2":{"name":"keyword.operator.logical.batchfile"},"3":{"name":"keyword.other.special-method.batchfile"}}},{"name":"keyword.control.conditional.batchfile","match":"(?\u003c=^|\\s)(?i)(?:if|else)(?=$|\\s)"},{"name":"meta.block.repeat.batchfile","begin":"(?\u003c=^|[\\s(\u0026^])(?i)for(?=\\s)","end":"\\n","patterns":[{"begin":"(?\u003c=[\\s^])(?i)in(?=\\s)","end":"(?\u003c=[\\s)^])(?i)do(?=\\s)|\\n","patterns":[{"include":"$self"}],"beginCaptures":{"0":{"name":"keyword.control.repeat.in.batchfile"}},"endCaptures":{"0":{"name":"keyword.control.repeat.do.batchfile"}}},{"include":"$self"}],"beginCaptures":{"0":{"name":"keyword.control.repeat.batchfile"}}}]},"escaped_characters":{"patterns":[{"name":"constant.character.escape.batchfile","match":"%%|\\^\\^!|\\^(?=.)|\\^\\n"}]},"labels":{"patterns":[{"match":"(?i)(?:^\\s*|(?\u003c=call|goto)\\s*)(:)([^+=,;:\\s]\\S*)","captures":{"1":{"name":"punctuation.separator.batchfile"},"2":{"name":"keyword.other.special-method.batchfile"}}}]},"numbers":{"patterns":[{"name":"constant.numeric.batchfile","match":"(?\u003c=^|\\s|=)(0[xX][0-9A-Fa-f]*|[+-]?\\d+)(?=$|\\s|\u003c|\u003e)"}]},"operators":{"patterns":[{"name":"keyword.operator.at.batchfile","match":"@(?=\\S)"},{"name":"keyword.operator.comparison.batchfile","match":"(?\u003c=\\s)(?i:EQU|NEQ|LSS|LEQ|GTR|GEQ)(?=\\s)|=="},{"name":"keyword.operator.logical.batchfile","match":"(?\u003c=\\s)(?i)(NOT)(?=\\s)"},{"name":"keyword.operator.conditional.batchfile","match":"(?\u003c!\\^)\u0026\u0026?|\\|\\|"},{"name":"keyword.operator.pipe.batchfile","match":"(?\u003c!\\^)\\|"},{"name":"keyword.operator.redirection.batchfile","match":"\u003c\u0026?|\u003e[\u0026\u003e]?"}]},"parens":{"patterns":[{"name":"meta.group.batchfile","begin":"\\(","end":"\\)","patterns":[{"name":"punctuation.separator.batchfile","match":",|;"},{"include":"$self"}],"beginCaptures":{"0":{"name":"punctuation.section.group.begin.batchfile"}},"endCaptures":{"0":{"name":"punctuation.section.group.end.batchfile"}}}]},"repeatParameter":{"patterns":[{"name":"variable.parameter.repeat.batchfile","match":"(%%)(?:(?i:~[fdpnxsatz]*(?:\\$PATH:)?)?[a-zA-Z])","captures":{"1":{"name":"punctuation.definition.variable.batchfile"}}}]},"strings":{"patterns":[{"name":"string.quoted.double.batchfile","begin":"\"","end":"(\")|(\\n)","patterns":[{"name":"constant.character.escape.batchfile","match":"%%"},{"include":"#variables"}],"beginCaptures":{"0":{"name":"punctuation.definition.string.begin.batchfile"}},"endCaptures":{"1":{"name":"punctuation.definition.string.end.batchfile"},"2":{"name":"invalid.illegal.newline.batchfile"}}}]},"variable":{"patterns":[{"name":"variable.other.readwrite.batchfile","begin":"%(?=[^%]+%)","end":"(%)|\\n","patterns":[{"name":"meta.variable.substring.batchfile","begin":":~","end":"(?=%|\\n)","patterns":[{"include":"#variable_substring"}],"beginCaptures":{"0":{"name":"punctuation.separator.batchfile"}}},{"name":"meta.variable.substitution.batchfile","begin":":","end":"(?=%|\\n)","patterns":[{"include":"#variable_replace"},{"begin":"=","end":"(?=%|\\n)","patterns":[{"include":"#variable_delayed_expansion"},{"name":"string.unquoted.batchfile","match":"[^%]+"}],"beginCaptures":{"0":{"name":"punctuation.separator.batchfile"}}}],"beginCaptures":{"0":{"name":"punctuation.separator.batchfile"}}}],"beginCaptures":{"0":{"name":"punctuation.definition.variable.begin.batchfile"}},"endCaptures":{"1":{"name":"punctuation.definition.variable.end.batchfile"}}}]},"variable_delayed_expansion":{"patterns":[{"name":"variable.other.readwrite.batchfile","begin":"!(?=[^!]+!)","end":"(!)|\\n","patterns":[{"name":"meta.variable.substring.batchfile","begin":":~","end":"(?=!|\\n)","patterns":[{"include":"#variable_substring"}],"beginCaptures":{"0":{"name":"punctuation.separator.batchfile"}}},{"name":"meta.variable.substitution.batchfile","begin":":","end":"(?=!|\\n)","patterns":[{"include":"#escaped_characters"},{"include":"#variable_replace"},{"include":"#variable"},{"begin":"=","end":"(?=!|\\n)","patterns":[{"include":"#variable"},{"name":"string.unquoted.batchfile","match":"[^!]+"}],"beginCaptures":{"0":{"name":"punctuation.separator.batchfile"}}}],"beginCaptures":{"0":{"name":"punctuation.separator.batchfile"}}}],"beginCaptures":{"0":{"name":"punctuation.definition.variable.begin.batchfile"}},"endCaptures":{"1":{"name":"punctuation.definition.variable.end.batchfile"}}}]},"variable_replace":{"patterns":[{"name":"string.unquoted.batchfile","match":"[^=%!\\n]+"}]},"variable_substring":{"patterns":[{"match":"([+-]?\\d+)(?:(,)([+-]?\\d+))?","captures":{"1":{"name":"constant.numeric.batchfile"},"2":{"name":"punctuation.separator.batchfile"},"3":{"name":"constant.numeric.batchfile"}}}]},"variables":{"patterns":[{"name":"variable.parameter.batchfile","match":"(%)(?:(?i:~[fdpnxsatz]*(?:\\$PATH:)?)?\\d|\\*)","captures":{"1":{"name":"punctuation.definition.variable.batchfile"}}},{"include":"#variable"},{"include":"#variable_delayed_expansion"}]}},"injections":{"L:meta.block.repeat.batchfile":{"patterns":[{"include":"#repeatParameter"}]}}}