If command - different with CMD

Apr 12, 2019
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
)
 
May 20, 2008
11,400
99
Syracuse, NY, USA
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
 
Apr 12, 2019
11
0
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!!!
 
May 20, 2008
11,400
99
Syracuse, NY, USA
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
Thread starter Title Forum Replies Date
Dmitry L. Kobyakov How to? How to remove the record of the old version of the Take Command? Support 5
D Can alias pass parameters to for command? Support 3
samintz How to? Search for %(command) in Help? Support 1
T VIEW only works from command line Support 14
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
T Take Command 28: Lua reports version 5.4.0 (5.4.3 expected) Support 0
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
J Take command does not start on Windows 10 Support 3
vefatica `Back quotes` - command line vs. batch file Support 5
Jay Sage WAD Failure of Alias Command with /Z Option Support 14
Phileosophos Is there any way to open the Take Command options dialog from the command line? Support 8
Phileosophos Command-line Editing Shortkeys That Fail Support 6
fpefpe How to? free (internal) command Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
T How to? retain command history across reboot? Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
Jay Sage Bug With Flow Control and/or Command Grouping Support 2
GermanDirk How to? EVENTLOG Command with simple User Rights not functional Support 4
Jay Sage Take Command Is Too Fast! Support 4
Jay Sage Comparison of IF with Command Group and IFF Support 6
D Open Windows 10 Photos app from command line Support 11
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
U Can not get/start Take Command gui Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
S Increasing Font Point Size in Command Tabs Support 2
mfarah Fixed The DATE command produces the wrong error message. Support 1
vefatica Command name mix-up Support 3
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
E How to? Closing desktop created by DESKTOP command Support 10
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
K Take Command fox XP? Support 7
Joe Caverly Documentation Replace internal command with LIBRARY command Support 0
fpefpe How to? command echo in title line/bar Support 2
U Command help on file names Support 5
vefatica Command line DO with no closing parenthesis? Support 9
vefatica Command history search is off Support 7
H How to? How can I say "if the command separator is not ~ then setdos /C~" Support 8
N Command execution slows down in TCC Prompt after a while Support 6
R Long commands retrieved from command history have blank line when wrapped Support 20
jpeni Take Command Language Examples Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
fpefpe winfr command Support 4
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
M Selecting test "off by one" problem in Take command Support 4
Dmitry L. Kobyakov Documentation Error in the Help: the WINDOW command Support 0
R How to? Open Take Command at current folder Support 7
rconn News Take Command / TCC / CMDebug / TCC-RT 26.01.40 uploaded Support 0
C TEE command appending null characters to output Support 6

Similar threads