如何ELSE出“跳过”?

时间:2016-01-02 16:15:48

标签: batch-file cmd command

这是我的代码:

IF EXIST "D:\Windows\\." IF EXIST "D:\Program Files\\." (
        IF NOT EXIST "D:\TP\\." (
            MD "D:\TP\"
            MD "D:\TP\ver 5.1\"
        )
        MOVE "app.exe" "D:\TP\ver 5.1\"
) ELSE (
SHIFT
)
IF EXIST "C:\Windows\\." IF EXIST "C:\Program Files\\." (
        IF NOT EXIST "C:\TP\\." (
            MD "C:\TP\"
            MD "C:\TP\ver 5.1\"
        )
        MOVE "app.exe" "C:\TP\ver 5.1\"
) ELSE (
SHIFT
)
IF EXIST "E:\......... for rest of available drives xD

我想要实现的是如果它们不符合我的标准则跳过整个命令。我做错了什么?

1 个答案:

答案 0 :(得分:0)

已解决(亨利克的评论)


IF EXIST "D:\Windows\" IF EXIST "D:\Program Files\" (
        IF NOT EXIST "D:\TP\" (
            MD "D:\TP\ver 5.1\"
        )
        MOVE "app.exe" "D:\TP\ver 5.1\"
    )
IF EXIST "C:\Windows\" IF EXIST "C:\Program Files\" (
        IF NOT EXIST "C:\TP\" (
            MD "C:\TP\ver 5.1\"
        )
        MOVE "app.exe" "C:\TP\ver 5.1\"
    )

但是,巫术来了(对斯蒂芬的领导权而言)并再次解决了这个问题


MD "%systemdrive%\TP\ver 5.1\"
MOVE "app.exe" "%systemdrive%\TP\ver 5.1\"