views:

89

answers:

1

I have problem with "%_Link%%num%" its not working show up link after load from txt format. I think "%_Link%%num%" is wrong syntax function. but I know %_Link1%,%_Link2%,etc can work... but i want loop that will add/change number # in variable name like "_Link#" changeable number as #. here code below...

TEXT FORMAT (NOTEPAD):

http://www.google.com
http://www.nba.com
test3
test5
test6
test7

SCRIPT code:

@echo off
:: LOAD FILE
SetLocal EnableDelayedExpansion
Set n=
Set _InputFile=loadlink.txt
For /F "tokens=*" %%I IN (%_InputFile%) DO (
Set /a n+=1
set /a i = 1
Set _Link!n!=%%I
Set /a num = 2
)


:loop1
CLS
echo.
echo %_Link%%num%
echo %i% seconds
start "" /b "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" %_Link%%num%
set /a i = i - 1
set /a num = num + 1
pause
GOTO loop1


:: pause
A: 

Try this:

ECHO !_Link%n%!
aphoria
it still not work :( it won't show up "http://www.nba.com" link.DOS said:21 secondsPress any key to continue . . .
aphoria: As that's clearly outside of a block using `!` isn't necessary there.
Joey
Johannes: You're right, I missed that at a glance.
aphoria
then other method? any idea to solve?
alienx2: Can you give us some more information on what you are trying to do?
aphoria
@aphoria, i want like loop with short script that every go to diff link (many links in loadlink.txt) with firefox.after getin add one to !NUM!.FOR EXAMPLE: i want every 5 secs per site. start batch and load up link from txt format then _Link1 go to google.com aftr 5 secs. after that, will add one to !NUM! then will be _Link!NUM! then _Link2 will show up link nba.com aftr 5 secs. then _Link3 will show up test3.com then _Link4 more than 30 sites(_Link30).but this problem is not show up link. its not work with %_Link%%num%. Output said:"2" not "_Link2" or not show link "www.nba.com" from %_Link2%
@alienx2 I changed my answer....check it out and give it a try.
aphoria
WOW!! It works... that answer is correct! thanks..
Awesome, glad I could help.
aphoria