Batch with for and if

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
heiner11
Newbie
Newbie
Posts: 3
Joined: Mon Apr 09, 2018 9:57 am

Batch with for and if

Post by heiner11 »

Debian Stretch with Wine 1.8.7:

I have a batch-file:

Code: Select all

@echo off
for %%i in (test) do (
    echo before-if: %%i
    if 1==1 (
        echo true
    ) else (
        echo false
    )
    echo after-if
)
:end
I get the following wrong output:

Code: Select all

before-if: test
true
The output should be:

Code: Select all

before-if: test
true
after-if
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Batch with for and if

Post by Bob Wya »

@heiner11

Confirming with a supported version of Wine (current release is 3.5, 1.8.7 is well out of the support window).

There are quite a few open Wine cmd bugs...
But none that appear to match your issue. So I'd recommend filing a new bug.

Bob
heiner11
Newbie
Newbie
Posts: 3
Joined: Mon Apr 09, 2018 9:57 am

Re: Batch with for and if

Post by heiner11 »

heiner11
Newbie
Newbie
Posts: 3
Joined: Mon Apr 09, 2018 9:57 am

Re: Batch with for and if

Post by heiner11 »

One possible wordaround with 2 files:

Code: Select all

@echo off
for %%i in (test1 test2) do (
    call batch2.bat %%i
)
:end

Code: Select all

@echo off
    echo before-if: %1
    if 1==1 (
        echo true
    ) else (
        echo false
    )
    echo after-if
:end
Locked