Search found 2 matches
- 21 Feb 2013 10:27
- Forum: DOS Batch Forum
- Topic: Multiple for loops for setting variables but only first work
- Replies: 1
- Views: 1668
Re: Multiple for loops for setting variables but only first
Solved. I had to remove spaces from around the assignment operators. For example, I changed branchName = %%a to branchName=%%a.
- 21 Feb 2013 10:01
- Forum: DOS Batch Forum
- Topic: Multiple for loops for setting variables but only first work
- Replies: 1
- Views: 1668
Multiple for loops for setting variables but only first work
Here's my Windows batch file: FOR /F %%a IN ('git rev-parse --abbrev-ref HEAD') DO SET branchName = %%a FOR /F %%a IN ('git rev-list --max-count^=1 %branchName%') DO SET localCommitId = %%a FOR /F %%a IN ('git rev-list --max-count^=1 origin/%branchName%') DO SET remoteCommitId = %%a @ECHO branchName...