批处理文件中IF ELSE的语法错误

时间:2017-05-16 21:47:50

标签: batch-file

我有兴趣搞乱批处理文件,我正在制作一个批处理文件来复制驱动器的内容。当我运行它时,程序在IF语句发生时停止。我该如何解决这个问题?

    @echo on
    TITLE Full Drive Back-up
    ECHO 1- "E:"
    ECHO 2- "F:"
    ECHO 3- "G:"
    SET /P choice=Which Drive would you like to backup: || Set choice=404
    ECHO:

    IF "%choice%" == "1" (
    ECHO Copying "E:"
    COPY "E:\" "D:\Desktop - data drive\Coding\Windows\Backup Storage\E"
    )

    IF %choice%==2 (
    ECHO Copying "F:"
    COPY "F:\" "D:\Desktop - data drive\Coding\Windows\Backup Storage\F"
    )

    IF %choice%==3 (
    ECHO Copying "G:"
    COPY "G:\" "D:\Desktop - data drive\Coding\Windows\Backup Storage\G"
    )
    PAUSE

感谢您阅读本文,祝您有个美好的一天。

0 个答案:

没有答案