Created
February 6, 2024 20:00
-
-
Save coryasilva/23a509367943aa3cbb942049265327c9 to your computer and use it in GitHub Desktop.
windows batch file delayed expansion
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
@setlocal EnableDelayedExpansion | |
@set hosts=server01 server02 server03 | |
@for %%h in (%hosts%) do @( | |
@set host=%%h | |
@set host_no=!host:~-1! | |
@echo !host! | |
@echo %%h | |
@echo:!host_no! | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment