0

簡単なスクリプト、おそらく簡単な質問:

set /p customsettings="Some input prompt: "
if /i %customsettings:~0,1% equ Y echo Some output

   ^-これはうまくいきます...

set custom=1
if %custom% equ 1 (
    set /p customsettings="Some input prompt: "
    echo Some output
)

   ^-...そしてこれはうまくいきます。
では、なぜこれがうまくいかないのでしょうか?:

set custom=1
if %custom% equ 1 (
    set /p customsettings="Some input prompt: "
    if /i %customsettings:~0,1% equ Y echo Some output
)

行がスキップされるのset /p customsettingsは、2 つの if ステートメントの間に挟まれた場合のみです。

なぜこれが起こるのか、そしてそれを修正する方法に興味があります。

注:EnableDelayedExpansionの設定に関係なく、問題は解決しません。

4

1 に答える 1