Skip to content

Instantly share code, notes, and snippets.

@coryasilva
Created February 6, 2024 20:00
Show Gist options
  • Save coryasilva/23a509367943aa3cbb942049265327c9 to your computer and use it in GitHub Desktop.
Save coryasilva/23a509367943aa3cbb942049265327c9 to your computer and use it in GitHub Desktop.
windows batch file delayed expansion
@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