开发者

Read each line in a txt file and assign variables using windows dos commands

I am copying the files from one path to svn working copy by comp开发者_运维知识库aring the those 2 folders using beyond compare commandline. Report will get generated after the comparison is done using beyond compare. If any extra files are present in the right side should get deleted from svn repsotiory. So I am using a below for loop to loop through that file. I want to use svn delete for all the right orphaned files in the txt file

FOR /F "tokens=* delims= usebackq" %%x IN (%TEXT_T%) DO (

echo %%x

)

Can you please let me know how can I assign the each line in the txt file and how can I apply svn delete command for that?

Any help would be appreciated


It sounds like what you really want is just:

FOR /F "tokens=* delims= usebackq" %%x IN (%TEXT_T%) DO (
svn delete %%x
)


Steenhulthin's answer is correct. @SONI if you want to do it your way (which is a hard way... which is a little funny cause the computer's doing it for you anyways so it's not really hard at all =P ) You can do the following:

SETLOCAL EnableDelayedExpansion
SET count=1
FOR /F "tokens=* delims= usebackq" %%x IN ("%TEXT_T%") DO (
SET var!count!=%%x
SET /a count=!count!+1
)
ENDLOCAL

That way, you'll get

var1 = first string

var2 = second string

so on and so forth.


you can set variables as you iterate the loop

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜