Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
flaskvacuum
- Posts: 43
- Joined: 08 Mar 2013 11:23
#1
Post
by flaskvacuum » 08 Mar 2013 11:26
not too sure why i can't print the value %%h
Code: Select all
file format is:
10.5.33.166 username01 passwd01 dog,cat,monkey
for /F "tokens=2,3*" %%i in (%File_dbname%) do (
echo %%i >> %File_Get-Log%
echo %%h >> %File_Get-Log%
)
current result shown:
username01
%h
-
mfm4aa
- Posts: 70
- Joined: 13 Feb 2013 14:02
- Location: Europe
#2
Post
by mfm4aa » 08 Mar 2013 12:00
What is "%%h"? If you start with "%%i", the next for loop variable name is "%%j".
-
flaskvacuum
- Posts: 43
- Joined: 08 Mar 2013 11:23
#3
Post
by flaskvacuum » 08 Mar 2013 12:20
What is "%%h"? If you start with "%%i", the next for loop variable name is "%%j".
Oh, i didn't know have to be in aplabatical order. Now most of my code are working. Thank you so much for the great pointers! Really learn from coding it then to just read it and assume then i understand it all.
Thanks a million.

-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#4
Post
by Squashman » 08 Mar 2013 13:33
flaskvacuum wrote:What is "%%h"? If you start with "%%i", the next for loop variable name is "%%j".
Oh, i didn't know have to be in aplabatical order. Now most of my code are working. Thank you so much for the great pointers! Really learn from coding it then to just read it and assume then i understand it all.
Thanks a million.

Well is that not the most logical way to do it? How else would it assign the variables?
What would have been your thought process for accessing the 4th token which holds dog,cat,monkey as its value?