Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

If command - different with CMD

Apr
11
0
Dear Madame and Sirs,

using cmd this works as expected - but not as .btm-file.
Is there any difference in using if statement?
Best Regards and thanks, Christian Weissenberger

REM shoud be used with parameters %1 etc.
set sourcefile_fdir="\\XAMPP-SRV\variandok\140297.docx"
REM set sourcefile_fdir=%1
set sourcefile_fn="140297.docx"
REM set sourcefile_fn=%2
FOR /F "delims=" %%I IN (%sourcefile_fn%) DO SET sourcefile_fn_unquoted=%%I
set sourcefile_fname=140297
REM set sourcefile_fname=%~n2
set sourcefile_extension=.pdf
REM set sourcefile_extension=%~x2
REM Quelle URL: How to extract extension of input file parameter using Windows batch script

REM Expansions:
set sourcefile_extension_doc=.doc
set sourcefile_extension_docx=.docx
set sourcefile_extension_pdf=.pdf
set sourcefile_extension_jpg=.jpg

REM ... should be equal
if /i %sourcefile_extension%==%sourcefile_extension_pdf% (
echo Do anything with the PDF
)
 
I see only one IF statement and it seems to depend on exactly two SET statements. That much works here. What version of TCC are you using?
Code:
v:\> type forumq.btm
set sourcefile_extension=.pdf
set sourcefile_extension_pdf=.pdf
REM ... should be equal
if /i %sourcefile_extension%==%sourcefile_extension_pdf% (
echo Do anything with the PDF
)
v:\> forumq.btm
Do anything with the PDF
 
No, I haven't.
But I do not understand the syntax of 2 nested if oder iff clauses.

Here I changed to IFF but this is better to read in several lines. But unfortunately it seems not to work.
IFF %sourcefile_extension%==%sourcefile_extension_jpg% THEN ( IFF %logfile_ja_nein%==ja THEN %imgconverterX_exe% %sourcefile_fdir% %target_jpg_dir% -cPDF -log"%pdir_logfiles_unquoted%LogFileBatch_%batchfile_fname_unquoted%.log" ) ELSE %imgconverterX_exe% %sourcefile_fdir% %target_jpg_dir% -cPDF

Many thanks!!!
 
It's hard to tell what you're doing. And you have no ENDIFF statements. In general, IFFs will look like this. The ELSEIFF and ELSE parts can be omitted.

Code:
IFF condition THEN
    <command>
    ...
    <command>
ELSEIFF condition THEN
    <command>
    ...
    <command>
ELSE
    <command>
    ...
    <command>
ENDIFF

Any <command> above can be replaced with an IFF ... ENDIFF group (as above).

Example:
Code:
iff %@eval[%1 MOD 2] == 0 then
    echo It's even.
    iff %1 GT 10 then
        echo And it's greater than 10.
    else
        echo And it's less than 11.
    endiff
else
    echo It's odd.
endiff
 

Similar threads

Back
Top