1.

Solve : For /F ..?

Answer»

ok i have this line " FOR /F "eol=; tokens=1,2* delims=," %i in ("%2%.txt") do start %i %j %k"
works fine.. but i need "%2%.txt" to be %2 , so i can type %0 %1 %2 .. but it doesent work , i tryed USING @set 2=%2 , but it still doesent understand.. how do i do this ?

any replys appreciated
What are you trying to do? How will you use this line? What will be in %2%.txt? Please post a sample. I think maybe you are confused about variables. Or is it me? Anyway, I am confused by your line. FOR at the command line has one % sign before the variable (%i) as you have shown in your post. In a batch file it needs two (%%i).

What is %2% and where does it get its value?

If it is a command line, where are %0, %1, %2 going to come from?

If it is a batch file, did you know that %0 always holds the path and name of the batch file, so you can't use it as a parameter?

What are %i %j %k? They look like they will be PROGRAM files and parameters since start is before them. (Why no quotes?)









thanks man.. i added another % to them and it works better , turns out that was just one of the problems .. the batch im using has +S & +L as an option .. the if statement was the problem with the +L one , but +S works as a save feature.. and it has to CREATE %A%.txt with is a random number , problem is it will only create %A% when its suppost to create %A%.txt , and even trying to get it to rename it .. and calling a batch file after to rename it doesent work..
You need to post the code that doesn't work.
@ECHO OFF
:A5A
@set A=%random:~1,4% & cd\euc\IH
if exist c:\euc\IH\sta.jap cls & type c:\euc\IH\sta.jap
if "%1"=="" CLS
if "%1"=="+L" GOTO A5B
if "%1"=="+S" GOTO A5D
GOTO A5E

:A5B
@set 2=%2
FOR /F "eol=; tokens=1,2* delims=," %%i in (%2.txt) do start %%i %%j %%k
GOTO A5C

:A5C
@Set 2= & CLS
Type C:\euc\IH\sta.jap
@Set B= & GOTO A5E

:A5D
echo %2 >%A%.txt
echo --}%3 %4 %5 - %2{-- %A% >>C:\euc\IH\sta.jap
cls & type C:\euc\IH\sta.jap
GOTO A5C

:A5E
type C:\euc\IH\sta.jap



Discussion

No Comment Found