Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[batch] prevent ^ from counting as an escape for % #4095

Merged
merged 2 commits into from
Nov 17, 2024

Conversation

God-damnit-all
Copy link
Contributor

In batch scripts (but not on the command line itself), % is only escaped by another %

You can test this by making a bat file that reads:

@echo off
setlocal
set var=A
if ^A==A echo test1
if ^%var%==A echo test2
if "^A"==^"^^A^" echo test3
if "^%var%"==^"^^%var%^" echo test4
if "^%%var%%"==^"^^%%var%%^" echo test5
endlocal
pause

@michaelblyons
Copy link
Collaborator

Can you add regression tests?

@deathaxe
Copy link
Collaborator

Thank's for taking care and contributing. I hope it is not too aggressive to have added some arbritary syntax tests to verify the fix and help not regressing it by future changes.

@deathaxe deathaxe merged commit f794bce into sublimehq:master Nov 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants