Help IF/IF NOT EXIST using batch

Intel
April 19, 2007 at 07:55:48
Specs: xp, Pentium IV 1ghz

Hello, i am trying to create a batch file on wich if one of the variables does not exit it will have to skip to the other, but i cannot manage to make if and if not work. Above is the code i have already written:


SET /P number_of_article=write in the number of the article:

set number_of_article=%number_of_article%

find "%number_of_article%"<test.txt>%number_of_article%.txt

@ECHO ON

FOR /F "tokens=2,3,4,5* delims= " %%i IN (%number_of_article%.TXT) do (set F1=%%i & Set F2=%%j & set F3=%%k &S et F4=%%l)

(F1 will be like 23, F2 will be like 26, f3 will be like 100, f5 will be like 600-i mean these number can be random, but they are always numbers)
cls

color 1f

REM Create temporary VBS file...

ECHO MsgBox "Press enter to start procedure... " >%TEMP%\tmp.vbs

REM Execute the VBS file

cscript.exe //Nologo %TEMP%\tmp.vbs

REM Delete the VBS file

DEL %TEMP%\tmp.vbs


@echo on
call msbatch xpto %F1%.txt C102 v2d_%F1%.txt
@echo on
type Rel_art_%F1%.txt > Rel_art_%F1%.log


@echo on
call msbatch xpto %F2%.txt C103 v2d_%F2%.txt C103 25
@echo on
type Rel_art_%F2%.dgn >> Rel_art_%F2%.log


@echo on
call msbatch xpto %F3%.txt C105 v2d_%F3%.txt C105 25

@echo on
type Rel_art_%F3%.dgn >> Rel_art_%F3%.log

@echo on

call msbatch xpto %F4%.txt C106 v2d_%F4%.txt C106 25
@echo on

type Rel_art_%F4%.txt >> Rel_lista_%F4%.log
pause

REM Create temporary VBS file...

ECHO MsgBox "Procedure finished" >%TEMP%\tmp.vbs

REM Execute the VBS file

cscript.exe //Nologo %TEMP%\tmp.vbs

REM Delete the VBS file

DEL %TEMP%\tmp.vbs

color 0f

:end

Can anyone give me a ligth? Thank you Maria



See More: Help IF/IF NOT EXIST using batch

Report •


#1
April 19, 2007 at 08:12:24

Neater info needed as I can't understand/find in your code the statements not working.

By the way why so many echo on through your code and why

SET /P number_of_article=write in the number of the article:

set number_of_article=%number_of_article%

the second line acts nothing.



Report •

#2
April 23, 2007 at 22:21:31

No matter how the vars get set, you can use lines like this to control the batch branching:

if !v1!'==' goto :sub1
if not !v1!'==' goto :sub2



=====================================
If at first you don't succeed, you're about average.

M2



Report •

Related Solutions


Ask Question