(这时是意外的批处理 [英] ( was unexpected at this time batch

查看:77
本文介绍了(这时是意外的批处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

批量运行时,出现(这时出乎意料"错误.为什么?我在变量和变量等于两边都加了引号.y后面有一个空格,然后是括号./p>

When running this in batch, I get a "( was unexpected at this time" error. Why? I have quotes surrounding both the variable and what the variable is equal to. There's a space after y, and then parentheses.

echo Would you like to update and restore to the latest OS? (-l -e) (Y/N)

set /p latestOS= ""

if "%latestOS%"=="y" (

echo Restoring...make sure your device is plugged in!

\idevicerestore\idevicerestore -l -e

echo Done.

timeout /t 2 /nobreak > NUL

) else (

    echo Okay. Where is the IPSW located? EX: C:\memez.ipsw

    set /p IPSWlocid= ""

    echo Alright. Is it a custom IPSW? Note that the device must be vulnerable to limera1n. (-c) (Y/N)

    set /p IPSWiscustomid= ""

    rem more stuff soon

)

:menu

在if LatestOS行中失败.

It fails at the if latestOS line.

推荐答案

当您有一个代码块(括号内的代码)时,无论在何处,批处理都将第一个未转义的)视为该块的结尾.在代码块中找到它.

When you have a code block (that's code inside of parentheses), batch considers the first unescaped ) to be the end of that block, regardless of where in the code block it is located.

else块中的第二个echo破坏了代码.要解决此问题,请使用^转义两个).

The second echo inside of your else block is breaking your code. To fix it, use ^ to escape both of the )s.

echo Alright. Is it a custom IPSW? Note that the device must be vulnerable to limera1n. (-c^) (Y/N^)

这篇关于(这时是意外的批处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆