Reputation: 181
So for reasons too long to explain I need to use a batch file to access information from a database. It isn't an ideal method, but it's the only one I could get working.
Here is the code that I am having some issues with:
FOR /F %%i in (C:\Users\c1921\my_Data\mytestUnits.txt) DO (
set "$Unit=%%i"
echo The unit is :!$Unit!
echo the token is still:%$token%
curl -H "Authorization: auth_token %$token%" https://ads-dev.examplewebpage.com/apiv1/dsns/!$Unit!/properties.xml>C:\Users\c1921\my_Data\XMLFile.xml
start C:\Users\c1921\my_Data\curltest.vbs
echo pause after checking all the properties of a unit
pause
)
The problem is I have four test units in mytestUnits.txt and it will print the token and unit for each one but only run this line once:
start C:\Users\cm\my_Data\curltest.vbs
I've tried using goto:next
but that hasn't helped either. I also understand that XMLDOM
(which I have written in curltest.vbs) doesn't have a close or delete method so I was thinking maybe that's the problem?
Any advice would be greatly appreciated,
DM
Edit:
I added echo pause after checking all the properties of a unit
to see when it reaches this point and this is only executed for the last item in the loop. I tried calling a new batch file with this information, but that hasn't worked either.
Upvotes: 1
Views: 172
Reputation: 9545
Try without start
FOR /F %%i in (C:\Users\c1921\my_Data\mytestUnits.txt) DO (
set "$Unit=%%i"
echo The unit is :!$Unit!
echo the token is still:%$token%
curl -H "Authorization: auth_token %$token%" https://ads-dev.examplewebpage.com/apiv1/dsns/!$Unit!/properties.xml>C:\Users\c1921\my_Data\XMLFile.xml
C:\Users\c1921\my_Data\curltest.vbs
echo pause after checking all the properties of a unit
pause
)
Upvotes: 3